Question: java programming For this assignment you will create two Java classes each in a separate Java file: 1. The first is the Box class that
For this assignment you will create two Java classes each in a separate Java file: 1. The first is the Box class that models a heavy "Box" that should be saved in a file called Box.java. This class should include the following: a. Four private integer instance variables store the Length, Width, Height, and Weight of the Box. Measurements are in feet and pounds. b. Four public methods (setters) to set the value of each of these parameters: setLength, setWidth, setHeight, and set Weight. c. Four public methods (getters) to return the value of each of these parameters: getLength, get Width, getHeight, and get Weight d. Two constructors: Constructor #1 (default constructor) - has no parameters and initializes each of the Box's instance variable to 0. Constructor #2 - that receive four integer parameters that would initialize the Box object's Length, Width, Height, and Weight. c. A method calculateVolume( ) which returns the volume (formula: Length*Width *Height) of the Box object as an integer. f method calculate Density which returns the density of the Box (formula: weight/volume) as a double, check for divide by 0. g. A method called toString that returns all information about a box object as a string in the form of: This Box has: Length = xxx, Width - yyy, Height Volume - ttt Density nnn.dd Xxz, Weight WWW
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
