Question
You are throwing a party for yourself and 9 of your friends. Each person (including you) is going to drink about 14 cans of juice.
You are throwing a party for yourself and 9 of your friends. Each person (including you) is going to drink about 14 cans of juice. There must be enough juice available for each individual. So 10 people * 14 cans/person = 140 cans. But the cans are only sold in 6-packs. Thus, you need to buy at least 24 of those 6-packs to satisfy everyone. The extra 4 cans can be saved for next time.
The program should report the minimum number of packs need to be bought, along with the number of extra cans that you will have. The program should also allow you to enter the name of the drink as a string and include that name in its results.
Hint: There are some scenarios in which you can buy exactly the desired number of cans, with no extra cans. Are the calculations different for these scenarios? Use an if statement to determine whether there are extra cans.
How would I do the math and print the results including the extra cans.
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