C++ Program Drink Machine Simulator Write a program that simulates a soft drink machine. The program should use a structure named Drink that contains the following information: The drink name The...


C++ Program Drink Machine Simulator Write a program that simulates a soft drink machine.


The program should use a structure named Drink that contains the following information: The drink name The drink cost The number of drinks in the machine The program should then create an array of 5 Drink structures. The elements should be initialized with the following data: Drink Name Cost Number in Machine Cola $0.65 20 Root Beer $0.70 20


Grape Soda $0.75 20 Lemon-Lime $0.85 20 Water $0.90 20 Every time the program runs it should enter a loop that performs the following steps. A list of drinks is displayed on the screen. The user should be allowed to quit the program or select a drink. You can have the user select a drink any way you want. One way would be to have the menu display with a number next to each drink. If the user selects a drink, he or she will next enter the amount of money that is to be inserted into the drink machine. The program should display the amount of change that would be returned and subtract one from the number of that drink left in the machine. If the user selects a drink that is sold out a message should be displayed. The loop then repeats asking the user if they want to quit or select another drink. When the user chooses to quit the program it should display the total amount of money the machine earned. Input Validation: When the user enters an amount of money do not accept negative values or values greater than $1.00. When the amount entered is less than the price of the drink display the message “Insufficient Funds” and return to the beginning of the selection loop.



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here