Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In java please a. Using UML notation, design a class called Mypoint in Microsoft Word to represent a point in the x - and y-coordinates.
In java please
a. Using UML notation, design a class called Mypoint in Microsoft Word to represent a point in the x - and y-coordinates. The class contains: a. Two private double data field called x and y for x and y coordinate. b. A no-argument constructor to create the point (0,0). c. A constructor to create a Mypoint object with specified value for x and y. d. A method get X( ) to return x coordinate. e. A method gety() to return y coordinate f. A method distance() to return distance from this point to a specified point of type MyPoint. 9. A method distance() to return distance from this point to a specified point with x - and y coordinate. h. A static method distance() to return distance from two MyPoint objects. Note that distance() method in part f to h is an example of Overload. Also, from now on, all methods are public unless specified to be private. In addition, all data fields will be private unless required to be public. b. Implement your UML design in part (a) above in a Java class. Note: You can reuse code when defining the three overload of the distance methods. That is, do NOT duplicate same code in the said three methods. c. Write a test program that will create two points (0,0) and (10,30.5) and display distance between these two points. Display three distance value using each of the distance methods overloaded beforeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started