Question: java In project box, write a Box class with width, length, and height attributes. This class should also have a constructor and a toString method.

java

In project box, write a Box class with width, length, and height attributes. This class should also have a constructor and a toString method. Add a method called volume that returns the volume of the box and a method called surfaceArea that returns the total surface area of the box. You should also add a grow method that increases the box's size by 1 unit in all three dimensions. To test this Box class write a TestBox class with a main in it. Your main method should create a few boxes of various sizes, compare their volumes to each other, then grow them once or twice and compare them again. Print out your boxes after each change you make.

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!