Question: Create a class named Square that contains data fields for length, width, and surfaceArea, and a method named computeSurfaceArea(). Create a child class named Cube

Create a class named Square that contains data fields for length, width, and surfaceArea, and a method named computeSurfaceArea(). Create a child class named Cube. Cube contains an additional data field named depth, a computeSurfaceArea() method that overrides the parent method, and computeVolume() method that calculates volume of the cube. Write a Java program that instantiates a Square object and a Cube object and displays the surface areas of the objects plus the volume of the cube. Save the programs as Cube.java, Square.jave, and DemoSquare.java

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!