Question: Using Java Eclipse, figure out how many snow globes can fit into a box object Design a Box class (Box.java) with data members for integer
Using Java Eclipse, figure out how many snow globes can fit into a box object
Design a Box class (Box.java) with data members for integer length, width, and height, accessor and modifier methods and methods for area and volume. Include a default constructor setting dimensions to 1 and a parameterized constructor where the user passes in desired dimensions. Include PRE and POST comments. Test the Box class before writing the application.
Write an application which uses Box objects. The company sells snow globes which come in a variety of cubic container boxes measured in inches. Some quantities of a snow globe (one size only) need to be shipped from one store to another. The company would like to know how many shipping boxes of various types are required and the cost for each. Packing material costs $0.0023 per cubic inch. Packing material is only needed on partially filled shipping boxes. Plastic wrap around the sealed box costs $0.0012 per square inch.
The user will enter the dimensions of the shipping box. Valid dimensions are multiples of 4 inches (Ex. 4 x 8 x 12 box is acceptable while 3 x 7 x 16 box is not valid). The user enters the box cost. The user enters the snow globe dimension. Valid dimensions are multiples of 4 such that at least one globe fits in the box. (Ex. If the shipping box is 4 x 8* 8 inches, then the snow globe cannot be 8 inches or more as not even one fits.) Use error detection loops to ensure valid data (see Test Case 1). The main loop allows the user to input any number of orders, using value 0 as the sentinel (see Test Case 2).
Output: You will run 3 test cases to turn in.
Test Case 1: Error checking (see sample output)
Test Case 2: Valid data
Test Case 3: Ship box: 24 x 16 x 8
Box cost: $4.99
Snow globe: 8
Quantities: 1 5 6 50
Notes:
Code must make use of two Box objects, one for the shipping box and one for the snow globe container. Once the Box object is declared, only Box methods may be used.
Use a NumberFormat object to display the costs in Currency.
Test Case 1:
Test Case 2:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
