
Cube contains:
- One double data field named side
- A double constant named DEFAULT_SIDE which is equal to 1.0
- A zero-argument constructor which sets side to the default value
- A one-argument constructor which sets side to the value passed, unless that value is less than or equal to zero
(requires error trapping) - Methods to get and set side
(the set method requires error trapping) - A method named getVolume which returns the volume of the Cube
- A method named getTotalSurfaceArea which returns the total surface area of the Cube
- A method named getSingleFaceSurfaceArea which returns the surface area of only one face of the Cube
- A method named displayCube which displays the Cube's parameters: side, volume, total surface area, and surface area of a single face
(format the output appropriately, including strings telling the user what exactly is being displayed)
Both files should be saved to the same directory: no hard coding of paths nor file names.
Sample Output
Here is a screenshot of my code running.
Cubism output
Due Date:
Monday, December 5th, 8:00am