Question: You will implement a complete class called Point that describes a point as it may be used in a graphics application. A point consists of

You will implement a complete class called Point that describes a point as it may be

used in a graphics application. A point consists of an x and y coordinate and a color.

Here are the specifications:

The class has three instance variables. x: an int representing the x coordinate. y: an int representing the y coordinate. color: a String that represents the color associated with the point.

There is also a static variable called countPoint. It should be incremented whenever you make a new Point

Methods you must implement: Constructor(s) - no argument(using Scanner) and 3 argument Accessor and mutator methods (get/set methods) translate: This method takes two int parameters, dx and dy. It then increments the x coordinate by dx, and increments the y coordinate by dy.

toString: Write the toString method associated with this class. The returned String has to be in the following form: (x,y) : [x and y values here], color: [color value here] ''.

equals Compares one point to another - if the x, y and color are the same return true

Start a driver to test this. Test constructors, setters, getters, equals and toString . In your driver print out the number of points you created using the static variable

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!