Create a class named Package with data field for weight in ounces, shipping method, and shipping costs. The shipping method is a character A for Air, T for Truck, or M for mail. The Package class contains a constructor that requires arguments for each weight and shipping method. The constructor class a calculatecost() method that determines the shipping cost based on the following table;

Weight Air Truck Mail
1-8 $2.00 $1.50 $0.50
9-16 $3.00 $2.35 $1.50
17+ $4.50 $3.25 $2.15

The Package class also contains a display () method that displays the values in all four fields. Create a subclass name InsuredPackage that adds insurance cost to the shipping cost based on the following table;

Shipping cost before Insurance Additional Cost
0 to 1.00 $2.45
1.01 to 3.00 $3.95
3.01 and over 5.55

Write an application named UsedPackage that instantiates at least 3 objects of each type (Package and Insurance) using a variety of weights and shipping methods codes. Display the results for each Package and InsurancePackage. Save the file as Package.java, InsuredPackage.java, and UsePackage.java

10 Years
Discussion Span
Last Post by masijade

So? What do you have? We are not going to do your homework for you. Not only do we, personally, not support cheating, but it is also against the terms and agreements you agreed to when you signed up for an account here.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.