Question: C++. With comments please! This program demonstrates runtime polymorphism. Supply appropriate interaction (input/output) with your user. Again, provide appropriate interaction (input/output) with your user. Class

C++. With comments please!

C++. With comments please! This program demonstrates runtime polymorphism. Supply appropriate interaction

This program demonstrates runtime polymorphism. Supply appropriate interaction (input/output) with your user. Again, provide appropriate interaction (input/output) with your user. Class Package - contains the following: 1. Member data: name, address, city, state, zip for both sender and receiver. weight, costPerOunce 2. Member functions: constructor to initialize all member data. setters and getters for all member data 3. Member function: calculateCost () returns a double of weight x costPerOunce 4. Ensure weight and costPerOunce >0 Class TwoDayPackage - inherits from Class Package and contains the following: 1. Member data: twoDayFee (an additional flat rate fee for two day shipping) 2. Member functions: setTwoDayFee(), getTwoDayFee(), Override calculateCost() to include twoDayFee Class OvernightPackage - inherits from Class Package and contains the following: 1. Member data: overnightRate (an additional cost per ounce rate for overnight shipping) 2. Member functions: setOvernightRate(), getOvernightRate(), Override calculateCost () to include overnightRate Create a Class Template vector "packages" of Package pointers. Dynamically add objects of type Package, TwoDayPackage, and OvernightPackage to the packages vector. Iterate through the vector to process the Packages polymorphically. That is, output the data contained in each object. Keep an accumulator of total cost and report the total cost after all object data has been reported

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!