Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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. o
"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:
x,y(double): representing the top-left 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 (e.g., non-negative dimensions).
Utilize your class hierarchy to draw these shapes in the appropriate colors and
positions to represent the flag of the UAE
image text in transcribed

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

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions