Question: The Overnight class will contain the following private data: table [ [ string , name, table [ [ One string containing the recipient's
The Overnight class will contain the following private data:
tablestringname,tableOne string containing the recipient's fullname Give the value "Undefined" as adefault if one is not provided by the usercalling codestringaddress,tableOne string containing the recipient's fulladdress Give a default value of "nowhere"if one is not provided by the user.floatCost per ounce,tableThe positive base cost per ounce to sendany package by any shipping methodintNumber of ounces,tableThe positive number of ounces a packageweighs to the nearest ounce but has aminimum and default value of If anumber is entered, change it to floatExtra cost per ounce,tableA positive extra cost per ounce for theovernight expedited arrival.
The Overnight class will contain constructors and one destructor. The destructor in this case will simply display a parting message Ex: Good bye cruel world! You won't have Overnight shipping anymore!" Feel free to be creative with the parting message. The constructors will be:
A default constructor with no arguments. It will provide default values to the member variables.
Another constructor will take arguments which are, in order: string name, string address, integer number of ounces, float cost per ounce, float extra cost per ounce.
Both constructors will issue to the screen a welcome statement of your own creativity welcome that includes your madeup shipping company's name, package type and your name such as
"Welcome to We Gotchu Shipping, Overnight package by Mrs C Delugach!
The Overnight class will also contain the following public functions:
tableFunction name,Return type,ArgumentsDescriptionGetNameAndAddressstring,none,tableReturns the concatenation of the namevariable a space and the addressvariableSetName void,string,tableSets the contents of the name membervariableSetAddressvoid,string,tableSets the contents of the address membervariableSetCostPerzvoid,float,tableApplies the given cost per ounce variableto the associated member variable, errorchecking as necessary.GetCostPerzfloat,none,tableReturns the member cost per ouncevalue
tableGetNumOzint,none,tableReturns the contents of the membervariable that holds the number ofounces the package weighsSetNumOzvoid,int,tableSets the member variable for number ofounces to the provided value makingsure that it is at least GetExtraPerz float,none,tableReturns the value in the member extracost per ounce variable.SetExtraPerz void,float,tableSets the given value to the associatedextra cost per ounce member variable
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
