Write out the code if possible. I\'d really appreciate it, thanks! Your local su
ID: 3626628 • Letter: W
Question
Write out the code if possible. I'd really appreciate it, thanks!
Your local supermarket is having a "coupon bonanza" this week, offering you incentives to come in and use all those coupons you have cut out of the paper. Of course, they hope you will buy lots of other items while you are in the store - but that does not concern us for this assignment!
The store offer is as follows:
1. If the face value of the coupon is 35 cents or less:
the first 4 of these get triple value, any additional ones get double value.
2. If the face value is over 35 cents but less than 51 cents, it gets double value - no matter how many there are.
3. If the face value is 51 cents or over but less than $1.00, it gets a value of $1.00.
4. Any coupons of $1.00 or more, get their face value.
Your assignment is to read in a series of face values for coupons, calculate and print the actual value of each one, total the actual value of all of the valid coupons and count how many valid coupons were processed. The maximum allowable face value of a coupon is $3.00. Any data value above that limit should cause an error message to be printed and the program should then continue on to the next coupon. Bad data must not be included in the count of valid coupons.
More specifically, your program must read in a series of face values from a data file that we have made for you. This file is arranged with one float number on each line (representing the face value of a coupon) and ends with a line containing a negative number as the sentinel. You may get this file, mp2coupn.txt, from Blackboard.
SUGGESTION You should design, compile, run and debug your program in stages. You might start by testing if your program can read and echo the data file. After this is working accurately move on to the calculations of the actual values for the coupons etc. Remember to use good style with consistent indentation, plenty of comments, good variable names etc. and don't forget to echo the data as it is read. The output must be clear and readable with appropriate string constants and spacing.
0.43
0.28
0.74
0.32
3.01
0.50
1.24
0.35
0.99
3.00
0.16
0.21
0.36
0.51
1.00
0.17
-0.30
You should not be reading this line
Explanation / Answer
this is the program u want please rate #include #include using namespace std; double actualValue=0; void actual_value(double cop) { int count=1; if(copcoup; if(coup0 ) { valid++; actual_value(coup); } else if(coup>0) coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.