Question: Develop multimedia design and programming application which involves drawing various shapes. Specifically, you need to design a class hierarchy to represent different geometric shapes, including
Develop multimedia design and programming application which involves drawing
various shapes. Specifically, you need to design a class hierarchy to represent different
geometric shapes, including "Line," "Circle," and "Rectangle, and probably other
shapes." the following is required:
Create a base class named "Shape" with the following properties:
o fill Color: specifying the color that fills the interior of a shape. o stroke
Color: specifying the color used to draw the outline of a shape
o strokeWidth double: specifying the width of the outline of a shape.
Extend the "Shape" class to create three subclasses:
o "Line": representing lines.
Include attributes: startX, startY, endX, endY double:
representing the coordinates of the line.
"Circle": representing circles.
Include attributes:
radius double: representing the radius of the circle.
centerX, centerY double: representing the center
coordinates of the circle.
"Rectangle": representing rectangles.
Include attributes:
double: representing the topleft coordinates of the
rectangle.
width, height double: representing the dimensions of the
rectangle.
arcWidth, arcHeight double: representing the horizontal
and vertical diameter of the arcs at the corners.
Implement appropriate constructors for each class.
Write setter and getter methods for each class.
Create a program to test these classes. Instantiate objects of each class, set their
attributes, and demonstrate the use of polymorphism by displaying the
properties of each shape.
Implement a method named draw in each class to simulate drawing the shape.
You can print messages like "Drawing a line from startX startY to endX
endY
Add validation for input values eg nonnegative dimensions
Utilize your class hierarchy to draw these shapes in the appropriate colors and
positions to represent the flag of the UAE
solve it using java
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
