[Solved] SOLVED:Distance

$25

File Name: SOLVED:Distance.zip
File Size: 141.3 KB

SKU: [Solved] SOLVED:Distance Category: Tag:
5/5 - (1 vote)

This program will generate a random coordinate, in which the x and y value is between 1 and 200Then it will generate 20 other points and determine which point is the closest and furthest fromoriginal point. Then it will calculate the distance from the original point to both points.Algorithm:1) Generate a random number between 1 and 200 for originalX2) Generate a random number between 1 and 200 for originalY3) Generate 20 random number between 1 and 200 for an array of Xs4) Generate 20 random number between 1 and 200 for an array of Ys5) Calculating the distance using for formula provided belowd2 = (x2 x1)^2 + (y2 y1)^2and storing all those distances in an array6) To find the min, set min = distance[0], and compare it to the first distance,if distance[0] < min, then set distance[0] to min, and keep going through the distance array7) To find the max, set max = distance[0], and compare it to the first distance,if distance[0] max, then set distance[0] to max, and keep going through the distance array8) Output the original point(x,y)9) Output the min (Closest Distance) with its coordinate10) Output the max (Furthest Distance) with its coordinate

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SOLVED:Distance
$25