Question
A class for drawing 2D geometric shapes provides two services to draw circles and rectangles. To draw a circle, one non-null point and a radius
A class for drawing 2D geometric shapes provides two services to draw circles and rectangles. To draw a circle, one non-null point and a radius are provided to the draw method. The method confirms successful completion of painting the required circle by returning a string formatted as follows: Circle: center (x, y), radius = n. The class also provides a draw method for drawing a rectangle from two points: top-left corner and bottom-right corner. Also, both shapes allow clients to calculate their area and perimeter. Notice that a point is a class (Point) that store two coordinates (x and y) and allows through a constructor to set values for these coordinates. Once the coordinates values have been set, they cannot be changed from within a point object or by an external client. . Define an abstract class Shape and extend it by two concrete classes: a Circle and a Rectangle. Store all files in the folder Based on the description above, write four specifications: one for each method of the two shapes. Add all the specification to the source files, each atop its method, using Java standard annotation.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started