Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

1. What is a bank draft? Are all bank drafts paper?

Answered: 1 week ago

Question

What is biochemistry?

Answered: 1 week ago