Question: Design a class named MyPoint to represent a point with its x coordinates and y. The class contains: The x and y private double data
Design a class named MyPoint to represent a point with its x coordinates and y. The class contains: The x and y private double data which represent the coordinates with the methods getter. A no-argument constructor that creates a point (0, 0). A constructor that constructs a point with specified coordinates. A public method named distance which returns the distance between this point and another point of type MyPoint. A public method named distance which returns the distance between this point and another specified point with its x and y coordinates. A static method named distance which returns the distance of two objects of the type MyPoint. a) Draw the UML diagram of the class (1 pt) b) Implement the MyPoint class (3 pts) c) Write a test program that displays the distance between two points (0, 0) and (3, 4) using the 3 distance methods. (1pt)
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
