Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a definition of a class named Point that might be used to store and manipulate the location of a point on the plane. The
Write a definition of a class named Point that might be used to store and manipulate the location of a point on the plane. The point is stored as two coordinates: x and y Both fields must be of double type and private. You will need to declare and implement the following public methods:
Two constructors:
noargument constructor that sets the point coordinates to and
a constructor that takes x and y coordinate of the point and sets class fields.
two accessor methods to retrieve the coordinates of the point called getX and getY
Methods setX and setY that set the private data fields
A method to move the point by an amount along the vertical and horizontal directions specified by the first and second arguments: movedouble dx double dy
The method to rotate the point by degrees clockwise around the origin called rotate Method does not take parameters and does not return any values.
Hint: when point is getting rotated clockwise around the origin the following changes happen to its coordinates:
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