Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ In this lab, you need to create a parent class, Package, and a derived class, OvernightPackage. The base class Package includes the following attributes:

c++image text in transcribedimage text in transcribed

In this lab, you need to create a parent class, Package, and a derived class, OvernightPackage. The base class Package includes the following attributes: . Sender information: senderName (string), senderAddress (string), senderCity (string), .Recipient information: recipName (string), recipAddress (string), recipCity (string), . Other package details: label (string), date (string), weight doule), costPerOunce senderState (string) and senderZIPcode (long). recipState (string) and recipZIPcode (long). (double), and insuranceType (string)). The attributes label, date, weight, costPerOunce represent the package label, the date the package is shipped, the package weight, and the standard shipping fee per ounce, respectively. The insuranceType attribute describes the extra package insurance option. A sender can purchase insurance coverage for mailpieces for up to S5,000 to protect against loss or damage. If the sender does not purchase insurance, then insurance Type is set to "none" and no extra charge is incurred. If the sender prefers to insure the package, then there are two options based on the package's declared value or desired coverage: up to $1,000, or up to S5,000 insuranceType can thus have the values: "none", "upto1000", or "upto5000" The specialized class OvernightPackage has an additional attribute . overnightFee (double). The attribute overnightFee represents an additional fee per ounce charged for overnight-delivery service. Each class must have the following member functions: . a constructor to initialize and validate all the corresponding attributes. For example, you need to ensure that weight, cost, fees all have positive values. shipping a certain package as described below as print function to print the package's attributes on the screen (specialized and e its own calculateCost function that calculates and returns the cost associated with set and get functions to assign values and retrieve attribute values (as needed) as well inherited), and its shipping cost. The base class Package's calculateCost function should determine the cost by multiplying the weight by the costPerOunce and adding the insurance fees if applicable

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions