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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 03:30, juliannxkim
Which group on the home tab allows you to add shapes to a powerpoint slide?
Answers: 1
image
Computers and Technology, 22.06.2019 10:30, ghazanfarwaheed7967
Auniversity wants to install a client-server network. which feature do you think is important for them as they set up the network? sending email blocking multiple people to use the same file low security low set up cost limited access to files
Answers: 1
image
Computers and Technology, 22.06.2019 18:30, leannhb3162
Which of these options are the correct sequence of actions for content to be copied and pasted? select content, click the copy button, click the paste button, and move the insertion point to where the content needs to be inserted. click the copy button, select the content, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, click the copy button, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, move the insertion point to where the content needs to be inserted, click the copy button, and click the paste button.
Answers: 3
image
Computers and Technology, 23.06.2019 03:50, dondre54
Q-1 which of the following can exist as cloud-based it resources? a. physical serverb. virtual serverc. software programd. network device
Answers: 1
You know the right answer?
In this lab, you will build a system for package delivery services that provides different shipping...

Questions in other subjects:

Konu
Mathematics, 01.05.2021 19:20