Question: Shape (Abstract) Triangle Ellipse Circle EquilateralTriangle Consider the following shapes; Ellipse, Circle, Triangle, EquilateralTriangle Each shape should have a name, a method to compute its

 Shape (Abstract) Triangle Ellipse Circle EquilateralTriangle Consider the following shapes; Ellipse,

Shape (Abstract) Triangle Ellipse Circle EquilateralTriangle Consider the following shapes; Ellipse, Circle, Triangle, EquilateralTriangle Each shape should have a name, a method to compute its perimeter, and another method to compute its area. The name should be an instance variable of type String. De superclass Shape. Notice that the area and perimeter are common to all Shapes, but we don't know how to compute the area or perimeter for a general shape . sign your inheritance hierarchy with the common features in the .The ellipse class has a major and minor axes a and b, respectively. The constructor should assign the largest value to a and smallest to b. The area and perimeters of an ellipse are Perimeter P 2b)-(a-b/2 [Note that if a-br, then P 2] .The Triangle class has three instance variables side, side2, and side3. The formula for the area and perimeter of a general Triangle with sides A, B, and C is given by AREA-S(S-A)SB(S -C) PERIMETER-A+ B + C A+B+ The condition for any three positive values to make sides of a Triangle is: . 4 + B > C and B + C>,A and C + A > B . You need to check this condition inside the constructor. If it is not satisfied, print an error message and terminate the program, otherwise make your Triangle object. The three sides of the equilateral triangle are equal Make a Test class where you make objects from the different classes and store them in an array of type Shape. Then, make a loop and print the objects name, area, and perimeter through toString i.e. you need to override toString in the Shape class only

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!