Computers and Technology

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.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 23:30, jcollings44
You picked the corridor which led you here. if the guards find you, they're going to be really angry! what is the synonym of angry
Answers: 1
image
Computers and Technology, 22.06.2019 08:30, marialuizavalen
Today is the anniversary of me being on yet, i don't need it anymore! here's a picture of my dog wearing a bowtie! my question is, how do i delete my account?
Answers: 1
image
Computers and Technology, 22.06.2019 17:30, cesargarcia17671
Type the correct answer in the box. spell all words correctly. under which key category do the page up and page down keys fall? page up and page down keys fall under the keys category.
Answers: 3
image
Computers and Technology, 24.06.2019 16:00, achsahjosey
This isn't about school but every time it tells me to watch an ad to unlock the answer to a question it prompts a survey and it just keeps loading. so i haven't been able to get answers for my tests in like a week.
Answers: 2
Do you know the correct answer?
In this lab, you will build a system for package delivery services that provides different shipping...

Questions in other subjects:

Konu
Biology, 15.12.2019 01:31