You will implement a class given a description of its behavior, a partial class diagram (showing only required public methods), sample code that uses the class, and a sequence diagram that illustrates key elements of this sample code.
Your job is to complete a program that will allow a ground shipping company to do various calculations regarding shipping packages on its trucks. These calculations take into account the size and weight of the packages, the fee to ship each package (which is a function of the package's size and weight), and the capacity (in volume and weight) of each truck.
The design has been completed for you. See the class diagram for details. Another software developer has already completed a Truck class and a ShippingCalculator class that contains various static methods for testing the other classes. Your job is to implement the Package class. The class diagram shows which public methods you must implement. If needed you may implement other methods, but they must be private. Also, you will need to add some attributes, but they must also be private.
You should begin by reviewing the Truck.java source code and its documentation. Then, review the ShippingCalculator.java source code, its documentation, and the sequence diagram to see how the pieces fit together.
Create an Eclipse project by following these steps:
| Length (in) | Width (in) | Height (in) | Weight (lb) | Fee |
|---|---|---|---|---|
| 12 | 14 | 16 | 10 | $38.89 |
| 3 | 4 | 6 | 3 | $9.38 |
| 72 | 10 | 6 | 15 | $62.50 |
| 20 | 20 | 40 | 1,000,000 | $1,041,666.67 |
| 5,000 | 20 | 15 | 75 | $21,701.39 |
Upon implementing Package correctly, your output in the Console tab will look similar to the following. Since the second test uses a random number generator, your numbers should be similar, but will not match exactly. Note: achieving output that looks like this does not guarantee that you have implemented Package correctly.
10# box costs $38.89 to ship. box of skis costs $62.50 to ship. really, really dense package costs $1,041,666.67 to ship. really, really long package costs $21,701.39 to ship. 10# box added box of skis added really, really dense package didn't fit really, really long package added A total of 4070 trucks were needed to contain 1000000 random packages that had a gross revenue of $77,198,100.37.