Question: A . Writing an Interface In this problem you will first write an interface and then modify classes to implement the interface. Write an interface,
A Writing an Interface
In this problem you will first write an interface and then modify classes to implement the interface.
Write an interface, GeometricSolid, which has one method, volume. The volume method takes no arguments and returns a double.
You are provided with three classes: Cylinder, Sphere, and RightCircularCone. Modify the classes so that they implement the GeometricSolid interface. Supply the appropriate method for each class. You can use Google search to find the formula for the volume of each shape. Make sure that you use Math.PI in your calculations.
Notice in InterfaceRunner that the objects are added to an ArrayList of GeometricSolids. This demonstrates the usefulness of interfaces. No need for you to do anything here.
Provide Javadoc and submit your interface to the CodeCheck.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
