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
Get step-by-step solutions from verified subject matter experts
