Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone please do this assignment for me please thank you so much in advance. One of major features of object-oriented programming is easy code

Can someone please do this assignment for me please thank you so much in advance.

One of major features of object-oriented programming is easy code reuse. A developer can add to a new class all the functionality of another class just by declaring that the new class (subclass) will inherit all public properties and methods from another parent, or base class. It is important to identify and develop the proper class hierarchy to identify collaborations between all the classes involved.

In this Assignment, using Java inheritance techniques, you will build a proper class hierarchy for a simple multi-class application and implement it in Java code.

Note: In this Assignment, you continue practicing code commentsyou will need to comment on the code statements and explain each block in your applications code.

Submit the following program:

Create a class named Package with attributes for weight in ounces, shipping method, and shipping cost. The shipping method is a character: A for air, T for truck, M for mail. The Package class has a constructor that requires arguments for weight and shipping method. The constructor calls the calculateCost() method that determines the shipping cost based of the following table:

Weight (oz) Air ($) Truck ($) Mail ($)
18 2.00 1.50 .50
816 3.50 2.75 1.50
17 and over 4.75 3.50 2.25

The Package class also contains a display() method that displays the values of all three attributes. Save the Package class as Package.java.

Create the subclass InsuredPackage that contains an attribute insurance type and adds insurance cost to the shipping cost, based on the following table:

Shipping Cost Before Insurance ($) Additional Cost for Standard Insurance (%) Additional Cost for Premium Insurance (%)
02.99 0 0
3.0010.00 5 10
10.01 and over 10 15

Save the Insured Package class as InsuredPackage.java.

Write an application driver class ShipPackage that instantiates two objects of each type (Package and InsuredPackage) using a variety of weights, shipping methods and insurance types. These values should be assigned as a users input. The application should display each package weight, shipping method, insurance cost, if any, and the shipping cost. Finally, the summary of all shipments should be provided: The application should accumulate and display total cost of shipping cost for all four packages. Save the class as ShipPackge.java.

Use Scanner or JOptionPane as a tool to accept users input. Make your application user friendly, providing the proper prompts informing a user what data is expected and what results are being shown when the application runs.

Add the proper Header to the ShipPackage.java file. Do not forget to include the comments for the code statements in all .java files to explain what those statements do.

Create and include a UML class diagram of the application illustrating class hierarchy, collaboration, and the content of each class (include as a part of the MS .doc documentation below).

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

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

Perform an Internet search. Discuss a company that uses EPLI.

Answered: 1 week ago

Question

How do you feel about employment-at-will policies? Are they fair?

Answered: 1 week ago