Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions

Question

1. Which position would you take?

Answered: 1 week ago