Answered step by step
Verified Expert Solution
Question
1 Approved Answer
pls help and explain the code Questions 1. Define the following class hierarchy for shapes (a) Define an abstract class Shape. Shapes have a color
pls help and explain the code
Questions 1. Define the following class hierarchy for shapes (a) Define an abstract class Shape. Shapes have a color (which can be a string for now) and a boolean indicating whether or not they are filled. These should be (b) Define an abstract class Shape2D that extends Shape. This class should define (c) Define a class Rectangle that extends Shape2D. A rectangle has a height and properly encapsulated. the abstract method getArea ) that returns the area of a a Shape2D. a width. Implement the getArea () method appropriately. Use the eOverride annotation. (d) Define a class Square that extends Rectangle. The class should have an ap propriate constructor and also override setter methods as approrpiate to preserve (e) Define a class E1lipse that extends Shape2D. An ellipse has a semi-major axis a and a semi-minor axis b (look it up if needed). The area of an ellipse is A b. (f) Define a class Circle that extends E1lipse. You need appropriate contruc- tor(s) and setter(s) for the class. Illustrate all of these with a main method in a separate test classStep 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