Question
C language Ice Cream Program Assignment Write a program that uses a function to ask the user to choose an ice cream flavor from a
C language Ice Cream Program Assignment
Write a program that uses a function to ask the user to choose an ice cream flavor from a menu (see output below.) You do NOT have to validate this users input for the flavor of ice cream.
Your main() function will then ask for the number of scoops. You must validate this data! Make sure that the user chooses at least 1 scoop but no more than 4. If they try another other, you must give them an error message and allow them to try again.
Your program will then calculate and display the cost of the ice cream. The cost of ice cream is $ .75 for the cone and $1.25 per scoop.
Your program will continue asking customers for the flavor and number of scoops until they choose Q to quit.
The program will then send all of the data to a function to display the total number of cones sold, the total amount collected, and the total scoops of each type of ice cream sold.
Sample Output:
Please Choose your Favorite Flavor!
V - Vanilla
C - Chocolate
S - Strawberry
Q - Quit
-----> v
How many scoops would you like? 2
Your ice cream cone cost $ 3.25
Please Choose your Favorite Flavor!
V - Vanilla
C - Chocolate
S - Strawberry
Q - Quit
-----> c
How many scoops would you like? 5
That is an invalid number of scoops!
You may only choose between 1 and 4
Please try again!
How many scoops would you like? 0
That is an invalid number of scoops!
You may only choose between 1 and 4
Please try again!
How many scoops would you like? 3
Your ice cream cone cost $ 4.50
Please Choose your Favorite Flavor!
V - Vanilla
C - Chocolate
S - Strawberry
Q - Quit
-----> s
How many scoops would you like? 1
Your ice cream cone cost $ 2.00
Please Choose your Favorite Flavor!
V - Vanilla
C - Chocolate
S - Strawberry
Q - Quit
-----> q
The total number of cones sold: 3
The total scoops of vanilla sold: 2
The total scoops of chocolate sold: 3
The total scoops of strawberry sold: 1
The total amount collected: $ 9.75
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