CISC 2000 Inheritance Lab Assignment #6 30 points Professor Papadakis The purpose of this lab is to practice implementing classes using Inheritance in C++. The assignment is to simulate a package delivery service, such as FedEx, DHL or UPL. The program should offer two shipping (i.e. packaging) options; two day delivery and overnight delivery. Each of these two services will have a specific cost associated with it which will determine the cost of sending the package. To accomplish the assignment you will need to create the following inheritance hierarchy to represent the types of packages: Base class: Package Derived Class: OverNightPackage Dervied Class: TwoDayPackage 1. The class Package will be used as the base class and should include at least the following attributes: Information for both the sender and the recipient Name Address City State Zip code Think about creating an independent class Customer to contain the required information for the sender and recipient. Declare two objects sender and recipient in the Package class to be objects of this class. In other words Package” has a” sender and a recipient so they are composition objects of Package. Although this may sound like extra work, it will actually simplify the coding of the Package Class. Information for the package being sent. Note that this information should be correct (e.g. no negative numbers): Weight of the package (in ounces) Cost per ounce to ship the package as well as the following behaviors: Member function calculateCost that calculates and returns the cost of sending the package as (weight*cost per ounce). Data Member mutator (i.e. set) and accessor (i.e. get) functions (as necessary) Member function(s) to get (and set) the recipient and sender information. Note: this would be a member function in the Customer class if one is created. A Function print() to print the Sender and Recipient Information. CISC 2000 Inheritance Lab Assignment #6 30 points Professor Papadakis 2. From class Package, derive two classes: TwoDayPackage and OverNightPackage. These derived classes should inherit all the functionality of the base class and additionally provide at least the following enhancements: Class TwoDayPackage should include: An attribute to represent a flat fee that is charged for sending a package using twoday service. This fee should be passed to the constructor and initialized when the object is created. A member function calculateCost() that overwrites the base classes’ member function and calculates the cost of sending the package using this service by adding the flat fee to the weight based cost. Accessor and mutator functions as necessary. A function print() that prints the sender and recipient information, any attributes associated with this package as well as the cost associated with sending this package. Class OverNightPackage should include: an attribute to represent an additional fee per ounce charged for using overnightdelivery service. This fee should be passed to the constructor and initialized when the object is created. a member function calculateCost() that overwrites the base classes’ member function and calculates the cost of sending the package using this service by adding the additional fee per ounce to the standard weight based cost. Accessor and mutator functions as necessary. A function print() that prints the sender and recipient information, any attributes associated with this package as well as the cost associated with sending this package. 3. Write a driver program that creates objects of each type of package and tests the member function calculateCost() for each type of delivery service. 4. After the functionality of the base and derived classes are tested and working, enhance the driver program to continually service customers (up to a maximum of 100 customers per package type) until there are no more customers. Each customer should be told how much the cost of sending his/her package was before servicing the next customer. The driver program should do this using two arrays of pointers; one for each package type. The program should prompt the user for the specific type of package to send and create the necessary object. Example: CISC 2000 Inheritance Lab Assignment #6 30 points Professor Papadakis TwdDayPackages[i] = new TwoDayPackage() OR OverNightPackages[i] = new OvernightPackage() 5. When there are no more customers a report should be printed summarizing information for each package sent that day, including sender and recipient information and the cost for sending that package. At the end of the report, summary information should be displayed indicating how many of each type of package was sent and the total amount of money each service generated. Note: This information should be kept as part of the class so give this one some thought….
© Copyright 2026 Paperzz