Question: Write the implementation of a class called 'Point'. Point has 2 data members x and y . Implement these methods: a ) a constructor that
Write the implementation of a class called 'Point'. Point has data members and Implement these methods:
a a constructor that takes arguments, one each for and
b getter methods for and
c a method that takes no usersupplied arguments and returns a string that is the printable version of a Point instance. This method should be named so that it is automatically invoked when the user calls printmyPoint where myPoint is an instance of Point.
d a method that can be used to compare instances of Point, returning true if both values are equal and both values are equal, and false otherwise. This method should be namedimplemented so that it will be automatically invoked when the user writes for example: if pp:
where p and p are instances of Point
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
