Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) Create a Java Project. 2) Create a class named Package.java with data fields for weight in ounces, shipping method, and shipping cost. - The

1) Create a Java Project.

2) Create a class named Package.java with data fields for weight in ounces, shipping method, and shipping cost.

- The shipping method is a character: A for air, T for truck, or M for mail.

3) The Package class contains a constructor that requires arguments for weight and shipping method.

- The Package class also contains a Display() method. It displays values in 3 fields (weight, ship method and cost) rather than 4.

- The constructor calls a calculateCost() method that determines the shipping cost, based on the following table:

image text in transcribed

4) Create a subclass named InsuredPackage that adds an insurance cost to the shipping cost, based on the following table:

image text in transcribed

5) Write an application named UsePackage that instantiates at least three objects of each type (Package and InsuredPackage) using a variety of weights and shipping method codes.

- Use the shipping types with the weights seen in the output below.

Output:

Packages:

The package weighs 4 ounces. Ship method A Cost $2.00

The package weighs 10 ounces. Ship method T Cost $2.35

The package weighs 20 ounces. Ship method M Cost $2.15

Insured packages:

The package weighs 4 ounces. Ship method A Cost $5.95

The package weighs 10 ounces. Ship method T Cost $6.30

The package weighs 20 ounces. Ship method M Cost $6.10

Weight (oz.) 1 to 8 9 to 16 17 and over Air (S) 2.00 3.00 4.50 Truck (S) 1.50 2.35 3.25 Mail ($) .50 1.50 2.15

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

More Books

Students also viewed these Databases questions

Question

Recognize the four core purposes service environments fulfill.

Answered: 1 week ago