Question: FedEx offers different shipping options, each with specific costs associated. Use classes to create an inheritance hierarchy to represent various types of package shipments. Use

FedEx offers different shipping options, each with specific costs associated. Use classes to create an inheritance hierarchy to represent various types of package shipments. Use class Package as the base class of the hierarchy, then include classes TwoDayPackage and OvernightPackage that derive from Package. 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, in addition to data members that store the weight (in ounces) and cost per ounce to ship the package. Package should provide a public member function calculateCost that returns a double indicating the cost associated with shipping the package. Derived class TwoDayPackage should inherit the functionality of base class Package, but also include a data member that represents a flat fee the shipping company charges for two- day-delivery service. Class OvernightPackage should inherit directly from class Package and contain an additional data member representing an additional fee per ounce charged for overnight-delivery service. CODE IN C++! FedEx offers different shipping options, each with specific costs associated. Use classes to create an inheritance hierarchy to represent various types of package shipments. Use class Package as the base class of the hierarchy, then include classes TwoDayPackage and OvernightPackage that derive from Package. 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, in addition to data members that store the weight (in ounces) and cost per ounce to ship the package. Package should provide a public member function calculateCost that returns a double indicating the cost associated with shipping the package. Derived class TwoDayPackage should inherit the functionality of base class Package, but also include a data member that represents a flat fee the shipping company charges for two- day-delivery service. Class OvernightPackage should inherit directly from class Package and contain an additional data member representing an additional fee per ounce charged for overnight-delivery service. CODE IN C++
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
