Question: Write a java class Cube with the following fields and methods and a driver class TestCube to test the Cube class by creating a cube
Write a java class Cube with the following fields and methods and a driver class TestCube to test the Cube class by creating a cube with dimension and display the volume. The Class should have a mechanism to keep track of how many instances have been created.
Note: Class and method names should have your first name attached CubeYourFirstName eg CubeBazlur, TestCubeBazlur, getVolumeInstanceBazlur getVolumeClassBazlur
Three private int data members named length, width, and height.
A noarg constructor that creates a default Cube with default values for each private fields.
A constructor that creates a Cuboid with the specified length, width, and height.
An instance method named getVolumeInstancethat returns the volume of the cuboid.
A class method named getVolumeClassthat returns the volume of a cuboid with supplied dimensions.
A class method named getVolumeClassthat returns the volume of a cuboid with supplied dimensions.
Accessors and mutators for each data field.
Draw the UML diagram for the class then implement the class. My name is Aryan.
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
