You will write a program that will calculate the order tax (tax) , the net cost (netCost) , and the total cost (totalCost)
of an online order.
• Assume the following tax rates (taxRate) based on the ID of the location (locationID)
o 0 <= locationID <= 50– TAX rate is 4% (.04)
o 51 <= locationID <=80 – TAX rate is 5.25% (.0525)
o 81 <= locationID <= 100– TAX rate is 6% (.06)
o locationID > 100 - TAX rate is 7.25% (.0725)
o < 0 – is not a valid entry for the locationID
• Use a string for the users first name only as you interact with the user
• Use a string for the cell phone number
• Use a string for the item number
• Use a string for the user letter input (“y” or “n”)
• Use int and double, not float
• The tax on the order is calculated by multiplying the quantity * price * taxRate /100
o Note: drop the 100 if you converted the rate from percentage
• The net cost is calculated by multiplying the quantity times the price
• The total cost will be calculated by adding the netCost and the tax
• All double output should be presented with 2 decimal places
• Use four functions to break up the program (functions may not be modified)
//BE SURE TO ADD COMMENTS TO THE FUNCTION PROTOTYPES AND THE FUNCITON DEFINITIONS
//fill out the pre and post conditions
void GetOrderInfo(string&, string&, int&, double&, int&);
//Precondition: State what is true before the function is called.
//Postcondition: State what is true after the function has executed.
//Description: Describe what the function does.
void GetTaxRate(double&, int);
//Precondition: State what is true before the function is called.
//Postcondition: State what is true after the function has executed.
//Description: Describe what the function does.
void CalculateResults(int, double, double, double&, double&, double&);
//Precondition: State what is true before the function is called.
//Postcondition: State what is true after the function has executed.
//Description: Describe what the function does.
void DisplayResults(string, string, int, double, int, double, double, double, double);
//Precondition: State what is true before the function is called.
//Postcondition: State what is true after the function has executed.
//Description: Describe what the function does.
The user will enter phone number (as a string) , the item number (as a string), the quantity (as an integer), the price (as a
double), and the location ID (as an integer) For program 2 you must use the following functions exactly as described above
(same name and same formal parameter data types in the same order)
These 4 functions MUST be called from the main function.
The purpose of the assignment is to practice pass by value and pass by reference.
You may add additional functions, but you MAY NOT modify the name or the formal parameters of the above
4 functions.
Additional instructions:
• Be sure to comment your code
• Include a program header with the following information:
o Name, due date, course, assignment number, professor name, and a brief description of the
assignment – see the sample skeleton provided with the assignment.
• Read all comments in the sample code before getting started
• Read the problem and determine what to do
• Write the algorithm (you DO NOT need to submit the algorithm)
• Implement one component at a time in your code and do not move onto the next component until you
are sure it is correct.
• Test your program before submitting
• One source code file (unformatted text) will be submitted
• The file name must match the assignment
• The code should be tested and run on a Microsoft compiler before it is uploaded onto Canvas
• The code must be submitted on time in order to receive credit (11:59 PM on the due date)
SAMPLE OUTPUT:
Enter your first name: Tami
Enter the cell phone number: 5612312233
Enter the item number? qwAs-rqwst123
Enter the quantity? 14
Enter the price? 17.12
Enter the location ID number? 52
Cell number: 5612312233
Item number: qwAs-rqwst123
Quantity: 14
Price: 17.12
Tax rate: 5.25%
tax: $12.58
Net cost: $239.68
total cost: $252.26
Tami, would you like to do another calculation (Y or N):
y
Enter the cell phone number: 5612129876
Enter the item number? trWq21vcx-hrJ
Enter the quantity? 200
Enter the price? 15.50
Enter the location ID number? -34
A negative number for the location ID is not a valid entry.
Cell number: 5612129876
Item number: trWq21vcx-hrJ
Quantity: 200
Price: 0.00
Tax rate: 0.00%
tax: $0.00
Net cost: $0.00
total cost: $0.00
Tami, would you like to do another calculation (Y or N):
n
Tami, Have a nice day!
for c++