This is not a current assignment. If you are currently enrolled in SE1010, do not do this assignment expecting to receive credit for it.

Lab 8: Arrays

Summary

In Lab 6 you were given a ShippingCalculator and Truck class and asked to implement a Package class. For this assignment you will modify these three classes to add functionality.

Modify the classes from Lab 6 so that the following is possible:

  • Each truck should accept no more than 100 packages.
  • Each truck can return the number of packages currently on the truck.
  • The last package added to a truck can be removed. Note: you do not need to be able to remove a package from the middle of the truck… only the last package added.
  • Each truck should be able to say whether or not it has a particular package on it. Two package objects are considered to be the same if they share the same weight, dimensions, and name (if the name exists).
  • Each truck can provide a list of all of the packages on the truck. The format for this list is shown below.
Package #: <weight> lbs, <length> x <width> x <height> [: <Package name>]

The example list provided by a truck may look something like this:

Package 1:     10.0 lbs, 12.0 x 14.0 x 16.0
Package 2:      3.0 lbs,  3.0 x  4.0 x  6.0
Package 3:     15.0 lbs, 72.0 x 10.0 x  6.0 : Very long package
Package 4: 100000.0 lbs, 20.0 x 20.0 x 20.0 : HEAVY

Notes

  • If either the weight or volume capacity is exceeded before 100 packages have been added, the truck should not accept additional packages.
  • You are encouraged to format the output so that each column is aligned vertically, but this is not a requirement for this assignment.
  • Update the test program so that it tests the new functionality you added.
  • Clearly indicate any changes made to the code since your lab 6 submission.
  • You are expected to incorporate the changes suggested by your instructor in his/her feedback when grading your lab 6 submission.

Deliverables

  • Updated UML class diagrams for the Truck and Package classes.
  • Updated Truck.java, Package.java and ShippingCalculator.java files.
se1010labs/lab8.txt · Last modified: 2009/06/03 11:22 (external edit)
 

This website is not owned or managed by the Milwaukee School of Engineering.

© 2003-2010 Dr. Christopher C. Taylor, et. al. • Office: L-343 • Phone: 277-7339 • npǝ˙ǝosɯ@ɹolʎɐʇ • -> RSS <-