Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Detailed Class Specifications TwoDay: The TwoDay class will contain the following private data: table [ [ string , name, table [ [ One
Detailed Class Specifications
TwoDay:
The TwoDay 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 floatFlat twoday fee,tableA positive flat fee added to the total basecost above for twoday expediting.
The TwoDay 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 Two Day 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 two day flat rate.
Both constructors will issue to the screen a welcome statement of your own creativity welcome that includes your made up shipper's name, package type and your name such as
"Welcome to We Gotchu Shipping, TwoDay package by Mrs C Delugach! In
The TwoDay class will also contain the following public functions:
tableFunction name,Return type,ArgumentsDescriptionGetNameAndAddress string,none,tableReturn the concatenation of the namevariable a space and the addressvariableSetNamevoid,string,tableSets the contents of the name membervariableSetAddressvoid,string,tableSets the contents of the addressmember variable.SetCostPerzvoid,float,tableApplies the given cost per ouncevariable to the associated membervariable error checking as necessary.
tableGetCostPerzfloat,none,tableReturns the member cost per ouncevalueGetNumOzint,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 GetTwoDayFeefloat,none,tableReturns the member flat fee for two dayshipping variable.SetTwoDayFeevoid,float,tableApplies the given two day fee to theassociated member variable.CalculateTotalCostfloat,none,tableCalculates and returns the total cost toship the package, which in this case isthe number of ounces multiplied by thecost per ounce plus the flat two day fee.PrintInfovoid,None,
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started