Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Now Write Some Code: Please write the code with clion c 9 9 The code as it is now gives a 1 0 % discount
Now Write Some Code: Please write the code with clion c
The code as it is now gives a discount for six packs. Your task is to modify it so that it gives a
discount for a case of bottles. It should maximize the savings by giving the maximum number of full
cases, then the maximum number of six packs from the number of bottles that didn't make it into cases, then
the number of left over bottles.
Here's some test data to check against:
If you have trouble getting the calculations to work, use the debugger to look at intermediate calculations to
see where you are going wrong.
Answer the questions for this part of the project in Gradescope.
Fix up the output
We really want to tell the person satisfying this order how many things to gather. Modify the printf statement
and make no other changes! so that your output looks like this:
Cases: Six packs: Singles: The total cost is $
Your output must match that format EXACTLY. Notice that the printf statement is rounding the cost to the
nearest penny and has added a dollar sign to the total cost. Here is the starting code that is given: #include
#define COSTPERBOTTLE
#define SIXPACKDISCOUNT
#define COSTPERSIXPACK COSTPERBOTTLE
SIXPACKDISCOUNT
int main
int numberofbottles;
int numberofbottlesleft;
int numberofsixpacks;
double totalcost;
printfPlease enter the number of bottles:
;
scanfd &numberofbottles;
numberofsixpacks numberofbottles ;
numberofbottlesleft numberofbottles ;
totalcost numberofbottlesleft
COSTPERBOTTLE numberofsixpacks
COSTPERSIXPACK;
printfThe total cost is f totalcost;
return ;
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