Lab 21

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

 

Create another class called BoxSorter

 

Example Dialog:

 

Welcome to the box sorter!

Enter the information about boxes and I'll 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

Video Games Box 1

4.0

4.0

3.0

Enter the label, length, width, and height (all feet) of box 4

Board Games Box 3

3.0

3.0

2.0

Enter the label, length, width, and height (all feet) of box 5

Imported Cheeses

0.5

0.5

0.25

Sorted boxes

Label: Imported Cheeses Volume: 0.0625

Label: Art supplies Volume: 3.0

Label: Random electronics Volume: 8.0

Label: Board Games Box 3 Volume: 18.0

Label: Video Games Box 1 Volume: 48.0

Lab Report Question:

  1. Define what “null” means.
  2. Is it safe to assume when an array of objects is declared and initialized that each of the individual objects is also constructed?

Finally:

Upload the all files to the dropbox