CS 1301 Practice Lab Test

100 Points

Submission: Submit under lab 10 of the electronic assignment submission page.

(100 points) Problem:
For this program you need to submit the source code (.java). You do not need a prolog or comments.

Write a program that prompts the user to enter the coordinates (x and y) of two points on the cartesian plane. Your program should then use the Pythagorean theorem to find the distance between the two points.

Below are some sample runs of the program:

Sample 1:
Hi!
Please enter the coordinates of the first point: 0 0
Please enter the coordinates of the second point: 10 0
The distance between the points is: 10.0


Sample 2:
Hi!
Please enter the coordinates of the first point: 10.2 4.5
Please enter the coordinates of the second point: -10.1 3
The distance between the points is: 20.355343278854324

Sample 3:
Hi!
Please enter the coordinates of the first point: -100 200
Please enter the coordinates of the second point: 100 400
The distance between the points is: 282.842712474619

hints


In the Figure above, you need to calculate a and b. The length a is a function of the only the x coordinates of the two points and the length b is a function of only the y coordinates.

To successfully complete this lab test: