Question: Define an interface named Shape with a single method named area that calculates the area of the geometric shape. public double area(); Next, define a

Define an interface named Shape with a single method named area that calculates the area of the geometric shape. public double area(); Next, define a class named Circle that implements Shape. The Circle class should have an instance variable for the radius, a constructor that sets the radius, accessor/mutator methods for the radius, and an implementation of the area method. Define another class named Rectangle that implements Shape. The Rectangle class should have instance variables for the height and width, a constructor that sets the height and width, accessor and mutator methods for the height and width, and an implementation of the area method. Define a third class named Triangle that implements Shape. The Triangle class should have instance variables for the height and width, a constructor that sets the height and width, accessor and mutator methods for the height and width, and an implementation of the area method. To test the interface Shape and the classes Circle, Rectangle, and Triangle, create an array of nine objects of type Shape. Then create nine objects (3 of each class that implements the interface Shape) and store them in the array. Finally, print the content of the array to display the area of the nine objects.

In java please

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!