Question: Q4) THE BOX CLASS Write a utility class Box and a driver class, BoxTest.java, used to test each constructor and method in the class. A

 Q4) THE BOX CLASS Write a utility class Box and a

Q4) THE BOX CLASS Write a utility class Box and a driver class, BoxTest.java, used to test each constructor and method in the class. A Box object should have three instance variables : double height, width, depth; Include three constructors: public Box(double w, double h, double d) initializes the three instance variables public Box() initializes all instance variables to 1 o public Box(double side) initializes all instance variables to side SESSION 2 PAGE13 Include the methods o public double volume() returns the volume of this Box o public int surfaceArea) returns the surface area of this Box o public String toString) retuns a String representation of this Box such as "Box with dimensions 4.3 x 6.5 x 9.0" o public double diagonalLength() returns the length of the diagonal, the square root of the sum of the squares of each dimension, of this Box o Three accessor methods (get methods), one for each instance variable o Three mutator methods (set methods), one for each instance variable

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!