Question: (In java, and please writes comment)Suppose we want to implement a drawing program that creates various shapes using keyboard characters. Implement an abstract base class

(In java, and please writes comment)Suppose we want to implement a drawing program that creates various shapes using keyboard characters. Implement an abstract base class DrawableShape that know the center (two integer values) and the color (a string) of the object. Give appropriate accessor methods for the attributes. Also a mutator method that moves the object by a given amount.

Create a class Square derived from DrawableShape. A Square object should know the length of its sides. The class should have an accessor method and a mutator method for this length. It should also have methods for computing the area and perimeter of the square. Although characters are taller than they are wide - so the number of characters in the vertical sides will differ from the number in the horizontal sides, do not worry about this detail.

Create a test class that creates an array of 10 instances of Square and sort them.

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!