subject

In this lab, you will build a system for package delivery services that provides different shipping options with specific price. You are required to create an inheritance hierarchy to represent the various types of packages. Use Package as the base class of the hierarchy and include classes TwoDaypackage and OvernightPackage that derive from Package. The base class Package should include data members representing the name, address, city, state and ZIP code for both the sender and the recipient of the package, and data members that store the weight (in ounces) and cost per ounce to ship the package. The constructor of the class Package should initialize these data members. The weight and the cost per ounce should contain positive values. The class Package should provide a public member function calculateCost that returns a double indicating the cost associated with shipping the package. The calculateCost function in class Package should determine the cost by multiplying the weight by the cost per ounce. The derived class TwoDayPackage should not only inherit the functionality of the base class Package, but also include a data member that represents a flat fee per ounce that the shipping company charges for two-day delivery. The constructor of the class TwoDayPackage should receive a value to initialize this data member. Class TwoDayPackage should redefine member function calculateCost so that it computes the shipping cost by adding a flat fee per ounce to the standard cost per ounce calculated by the calculateCost function in the base class Package. The requirements of the derived class OvernightPackage are similar as that of the class TwoDayPackage. Specifically, class OvernightPackage should inherit directly from class Package and contain an additional data member representing an additional flat fee per ounce charged for overnight delivery. Class OvernightPackage should redefine member function calculateCost so that it adds the additional fee per ounce to the standard cost per ounce when calculating the shipping cost.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:00
Our primary purpouse as electricians is to do wich of the following core concepts? a: install electrical components in a way they can be upgraded b: install electrical equiptment in a way that reduces heat c: install electrical systems in a safe manner d: only b and c
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
Who can provide you with a new password when you have forgotten your old one? your provide you with a new password in case you forget your old one.
Answers: 3
question
Computers and Technology, 23.06.2019 08:00
What is a scenario where records stored in a computer frequently need to be checked
Answers: 2
question
Computers and Technology, 23.06.2019 08:30
When you interpret the behavior of others according to your experiences and understanding of the world your evaluation is
Answers: 1
You know the right answer?
In this lab, you will build a system for package delivery services that provides different shipping...
Questions
question
English, 06.05.2020 00:30
question
Mathematics, 06.05.2020 00:30
question
Mathematics, 06.05.2020 00:30