Question: If your programmer number is odd, you are assigned Task A . Make the following 2 functions. Copy mailOrderA.h from my public directory into your
If your programmer number is odd, you are assigned Task A Make the following
functions.
Copy mailOrderA.h from my public directory into your cs directory. Complete the functions in that file.
Write a function called calcDiscount that will calculate a discount amount and return it If price is and month is
discount this function should return
If you are returning only one value, what technique should you use? return rather than pass by reference
pr is the total price of all the items the customer is buying.
mo is the month when the customer is placing an order.
This function calculates a discount amount as follows and returns it
Month ordered Discount on total sale amount before tax
Jan May
Jun Aug
Sep Dec
calcDiscountdouble pr int moYou may not change these parameters
Complete this function in mailOrderA.h that you downloaded from my public directory.
Compile your h file.
smith@empress cs g mailOrderA.h
If your h compiles, test calcDiscount before you move onto the next function.
How? dont add main in the h file Make a test cpp called testMailOrder.cpp and create a main function in
this cpp file just like you made testMyMath.cpp to test myMath.h Call only calcDiscount in main and make sure
it returns the right value. You dont need to call the other functions when you test calcDiscount. Each function
should be able to run and test independently from the others.
Test calcDiscount function for each category and discount Make sure the function returns the correct value.
You could use the following sets of values.
Total price
Month testing discount
Total price
Month testing discount
Total price
Month testing discount
testMailOrdercpp
Include your header file
int main
How do you show what the function returns? You have to add a little more code.
calcDiscount; change the month
return ;
Compile your cpp and run.
smith@empress cs g testMailOrder.cpp
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
