Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write a c++ program. Your program presents the user with a choice of your favorite beverages. Then allow the user to choose a beverage
Please write a c++ program.
Your program presents the user with a choice of your favorite beverages. Then allow the user to choose a beverage by entering a pair of inputs. The output which beverage user chooses. Let A set of favorite beverages = {Coke, Pepsi, Water}. Let B set of valid user input for above drinks = {(A, 1), (B, 2), (C,3)} C1, C2, and C3 are the logic inputs. There are 8 possible truth values or 8 digital logic inputs. Only 3 pairs are valid for 3 favorite beverages. The machine can hold maximum 10 drinks for each of the logic inputs. Input/output Table for the vending machine The truth table and The Boolean Expression Corresponding to the Digital Circuit User Output Logic Output For output Input variables Display the drink cost from the keyboard C1 C2 C3 0 Invalid 0 0 0 0 Not available selection (A.1) Coke 0 0 1 1 $1.50 Invalid 0 1 0 0 Not available selection (B.2) Pepsi 0 1 1 1 $1.75 Invalid 1 0 0 0 Not available selection (C,3) Water 1 1 1 $1 Invalid 1 1 0 0 Not available selection Invalid 1 1 1 0 Not available selection 0 Your program should operate continuously with a list of drinks and their costs displayed on the terminal. Example of the keypad: A1 12 INSTRUCTIONS B3 14 C5 16 1 For price of desired item press corresponding key Price appears on display 3 Insert coins Make selection on keypad D 17 18 # 19 10 Once a user has selected their drink the system should allow them to enter the amount of money they are inserting into the machine. The program should then calculate the amount of change to be returned and subtract one from the number of the drink in the machine. If the user selects a drink which has sold out an appropriate message should be displayed. Some input validation should be carried out on the selection from the true table. Anay/vector must be used and an expected looping menu-driven of the keypad. Extra credit: Once a user has selected their drink, the system should allow user to enter the amount of money they are inserting into the machine. The program should then calculate the amount of change to be returned from the machineStep 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