I just need the first question
Question 3 (5 points):
Q3) Write a Java class Point to represent a point with x and y coordinates. The
class Point has the following:
Attributes:
• double x
• double y
Methods:
• Setters and getters for x and y.
• distance(Point p): double. This method returns the distance between the two
points: p and the calling object.
hint: to compute distance between two points, use the equation:
Distance = √(𝑥2 − 𝑥1)
2 + (𝑦2 − 𝑦1)
2
Write another class TestPoint that does the following:
1. Declare two Point objects p1 and p2
2. Read the values of x and y for both points.
3. Compute the distance between the two points using the method distance,
if the distance is less than or equal to 5.0 you should print the distance and
exit. Otherwise keep reading two more points and printing the distance
until you get two points with distance less than or equal to 5.0.
Sample run1:
Enter x and y for p1 1 2
Enter x and y for p2 6 8
Distance is 7.810249675906654 which is > 5. Try again.
Enter x and y for p1 2 6
Enter x and y for p2 9 18
Distance is 13.892443989449804 which is > 5. Try again.
Enter x and y for p1 1 1
Enter x and y for p2 4 3
The two points are close.
The distance between them is 3.605551275463989 which is
less than 5
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of