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 2,3, and 5, 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 (e.g., CubeBazlur, TestCubeBazlur, getVolumeInstanceBazlur(), getVolumeClassBazlur()).
Three private int data members named length, width, and height.
A no-arg constructor that creates a default Cube with default values 1 for each private fields.
A constructor that creates a Cuboid with the specified length, width, and height.
An instance method named getVolumeInstance()that returns the volume of the cuboid.
A class method named getVolumeClass()that returns the volume of a cuboid with supplied dimensions.
A class method named getVolumeClass()that 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 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!