CJCoding With Joseph
15free / daySign inCreate account

Solid is an abstract class that stores a name and leaves volume() and surfaceArea() abstract. Write the concrete class Cuboid (a box) that extends it.

Requirements: 1. Three private double fields: width, depth and height. 2. A public constructor Cuboid(double width, double depth, double height) that calls the Solid constructor with the name Cuboid and stores the three values. 3. volume() returns width * depth * height. 4. surfaceArea() returns twice the sum of the three different faces: width * depth, width * height and depth * height. 5. Leave describe() alone. It is inherited from Solid and calls both of your methods.

Do not change the Solid class.

Do NOT write a main method.

Expected output

Cuboid
24.0
52.0
Cuboid: volume 24.0, surface 52.0

= newline. The output ends with a newline, so print one after the last line.

Hints4 available
Topics
Abstract ClassesClasses
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)

Your output

Run your code to see the output here...

Test cases

Run your code to see test case results.