Question
1. Create class called MyPoint 2. Define its properties as x and y. 3. Create default like constructor. 4. Create two parameter constructor. 5. Implement
1. Create class called "MyPoint"
2. Define its properties as x and y.
3. Create default like constructor.
4. Create two parameter constructor.
5. Implement the accesors/getters and mutators/setters.
6. Write a method called displayPoint() that will display in the CLI the point in the following format (x, y) => example if x coordinate is 5 and y coordinate is -7 then the output is "(5, -7)"
7. double getDistance(int x, int y) => Gets the distance between two points
8. double getDistance(MyPoint p) =>Gets the distance between two points
9. Override toString() that will return a string representation same as the displayPoint()
10. isOrigin() => return true or false if its in the origin in the cartesian plane
11. int getQuadrant() => return the coresponding quadrant if not then -1.
Step 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