Question: Write a java program (using Try/Catch) that will read the coordinates for number of points from the user. Calculates the distance between all the points.

Write a java program (using Try/Catch) that will read the coordinates for number of points from the user. Calculates the distance between all the points. The program should do the following:
1. Prompt the user to enter the points. if the user enters any invalid input (ex. Letter), the program should display an error message and asks the user to enter the numbers again.
[Hint: the users input should be saved in a string variable and then parsed to Integer or double]
2. For each point, the user should enter the X-Y coordinate.
3. Calculate the distance between all the points. The distance between two points a (x1, y1) and b (x2,y2)
formula is:
 Write a java program (using Try/Catch) that will read the coordinates

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!