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: