Question: JAVA 1. Write a class called Cube . a. Include integer variables for the width, height and length of the cube. Include a variable for

JAVA

1. Write a class called Cube.

a. Include integer variables for the width, height and length of the cube. Include a variable for the volume of the cube.

b. Write a method calcVolume that uses the length, width and height to calculate the volume and set the volume variable in the class.

c. Write a constructor that sets the length, width and height. Have your constructor call calcVolume to calculate and set the volume variable in the class.

d. Write getters and setters for the length, width and height. Write a getter for the volume variable.

e. Write a method that determines whether the cube is a square cuboid and returns true if it is and false if it is not. A rectangular cuboid or cube is a square cuboid if two of the sides are squares. ( In other words, its a box where all the edges are the same length. )

f. Write a CubeApp class that instantiates a cube and initializes the sides so that the object is a square cuboid.

g. Print the volume and whether the object is a square cuboid or not.

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!