Question: 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

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 class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!