Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using your shape class - Add an abstract draw(Graphics g) method to your abstract Shape class Create a Rectangle, Oval, Triangle, Pentagon & Hexagon class

Using your shape class - Add an abstract draw(Graphics g) method to your abstract Shape class

Create a Rectangle, Oval, Triangle, Pentagon & Hexagon class that are all extended from an abstract Shape class (given below).

Extend the Rectangle class to make a Square class. Extend the Oval class to make a Circle class. The shape classes will contain state information for the object to be drawn o All the different shapes will need a draw method but each one will be slightly different

All extended classes should also implement a toString method it is up to you how you want to represent the Shape as a String

All extended classes should also implement a equals method to compare two shapes o The Oval, Circle, Triangle, Rectangle, Square, Hexagon and Pentagon classes should have the same number of constructors with the same arguments, in addition to any other fields that are needed to create those shapes

To initialize the private instance fields of the Shape class you will need to make calls to the superclass constructor. Private fields and methods of a superclass are not directly accessible in the subclasses as if you were in the same class

Then initialize fields specific to the particular Shape class you are implementing o If done correctly the Square classes will have the least amount of code because it can reuse most of the Rectangle class methods.

Hint: use super class constructors correctly and all this class should have is constructors and a toString method o Select some random image(s) and fill the larger shapes with that image.

Using your classes, implement the Random Shape Generator application that runs for 6 seconds and draws one random shape every 1000 milliseconds. No shape can be drawn more than 9 times.

Other requirements: background should be random color than black

Shapes should be of random sizes

Shapes should be of random colors different than the background.

Shapes should be drawn in random locations

Shapes can overlap a little bit

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

Databases Illuminated

Authors: Catherine Ricardo

2nd Edition

1449606008, 978-1449606008

More Books

Students also viewed these Databases questions

Question

What has been done before?

Answered: 1 week ago

Question

=+ What would it look like? Who should deliver it?

Answered: 1 week ago