Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with problem 8. It's C programming. Write a program that will simulate a soft drink machine that dispenses four types of soft
I need help with problem 8. It's C programming.
Write a program that will simulate a soft drink machine that dispenses four types of soft drinks. The program will accept character input only. The symbols 'C' 'O', 'L', and 'S' will stand for the drinks (Cola, Orange, Lemon, and Spritzer). The symbols 'N', 'D', and 'Q' will stand for the coins nickel, dime, and quarter). No other coins will be accepted. The character 'R' when read as input will stand for the coin return. Any time that 'R' is input, all money should be returned to the user. The program will output messages that simulate the output from the soft drink machine. For example, "cola dispensed, " "30 cents returned", "Sorry, out of Spritzer, " or " Your change is 10 cents." In addition to accepting input of the money and drink selections, and displaying messages to the user, the program will internally keep track of the amount of change, and the inventory each drink. A sample run follows. Enter 65 cents for a drink > Q 25 cents received > D 35 cents received > D 45 cents received > D 70 cents received Make your drink selection now > o Orange drink dispensed 5 cents in change given Enter 65 cents for a drink > Q 25 cents received >Q 50 cents received > C Sorry, insufficient funds entered Please enter additional 15 cents > R 50 cents returned Enter 65 cents for a drink > Write your program in a modular structured style with the different modules in separate source files. Plan the communication between the different parts of the program. Minimize your use of global variablesStep 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