Question: Box Sorter! Objective: Write a program where the user enters in information about 5 boxes, and then they are sorted by their volume. Create a

 Box Sorter! Objective: Write a program where the user enters in
information about 5 boxes, and then they are sorted by their volume.

Box Sorter! Objective: Write a program where the user enters in information about 5 boxes, and then they are sorted by their volume. Create a class called Box This class has four instance variables o Label: the name of the box Length: the length in feet o Width: the width in feet Height: the height in feet .Assume Length, Width, and Height are all decimal values o Default o Parameterized (MUST CHECK FOR VALID VALUES) . Accessors for every instance variable e variable Mutators for every instanc o CHECK FOR VALID VALUES o Length Width and Height should all be greater than 0 . Other methods o getVolume: this method returns a decimal value corresponding to its volume. It also has no parameters o toString: This method returns a string which is made up of the label of the box and its volume Create another class called BoxSorter This class has a main method . An array of boxes Prompts the user for box information . Sorts the boxes . Displays the sorted boxes Example Dialog: Welcome to the box sorter! Enter the information about boxes and I'11 sort them Enter the label, length, width, and height (all feet) of box 1 Random electronics 2.0 2.0 2.0 Enter the label, length, width, and height (all feet) of box 2 Art supplies 1.0 3.0 1.0 Enter the label, length, width, and height (all feet) of box 3

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!