ITEC 120 Back to Assignment index page Assignment 1 - Computing Distance
Submit your program to the RU03 folder in your folder on neelix.Description:
Write a java program to compute the distance between two points. Recall that the distance between the two points (x1, y1) and (x2, y2) is computed by the formula:
Ask the user to enter the two points as input. Compute the distance between the two points. Display the two points along with the distance between the two points. Display the distance to two decimal places.
Sample run:
Program displays: Enter the x coordinate of the first point: User enters: 3 Program displays: Enter the y coordinate of the first point:
User enters: 17 Program displays: Enter the x coordinate of the second point: User enters: 8 Program displays: Enter the y coordinate of the second point:
User enters: 10 Program displays: The distance between point (3, 17) and point (8, 10) is 8.60 To get full credit on this program:
- Include your name in the documentation header of your program.
- Make sure your program is properly indented and documented.
- Include the original points (which were entered by the user) in the output, in the format shown.
- Compute the correct distance.
- Display the distance to two decimal places.
- Put your .java file in the RU03 folder in your folder on neelix.
- Compile and run your program immediately before submitting it. Never make a change to your code and turn it in without compiling and running it first. It is very easy to make a last minute mistake that introduces syntax errors, so checking before submitting can save you an unnecessary grade of 0! (Note: You cannot compile java files once they are on neelix.)