Answered step by step
Verified Expert Solution
Link Copied!

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 c99
The code as it is now gives a 10% discount for six packs. Your task is to modify it so that it gives a 15%
discount for a case of 24 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: 1, Six packs: 3, Singles: 1. The total cost is $48.50
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 COST_PER_BOTTLE 1.29
#define SIX_PACK_DISCOUNT 0.10
#define COST_PER_SIX_PACK COST_PER_BOTTLE *(1-
SIX_PACK_DISCOUNT)*6
int main(){
int number_of_bottles;
int number_of_bottles_left;
int number_of_six_packs;
double total_cost;
printf("Please enter the number of bottles:
");
scanf("%d", &number_of_bottles);
number_of_six_packs = number_of_bottles /6;
number_of_bottles_left = number_of_bottles %6;
total_cost = number_of_bottles_left *
COST_PER_BOTTLE + number_of_six_packs *
COST_PER_SIX_PACK;
printf("The total cost is %10.2f", total_cost);
return 0;
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2016 Riva Del Garda Italy September 19 23 2016 Proceedings Part 3 Lnai 9853

Authors: Bettina Berendt ,Bjorn Bringmann ,Elisa Fromont ,Gemma Garriga ,Pauli Miettinen ,Nikolaj Tatti ,Volker Tresp

1st Edition

3319461303, 978-3319461304

More Books

Students also viewed these Databases questions

Question

What are oxidation and reduction reactions? Explain with examples

Answered: 1 week ago

Question

What is the orientation toward time?

Answered: 1 week ago

Question

4. How is culture a contested site?

Answered: 1 week ago