Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write this program in c++ C 1, C 2, and C3 are the user inputs, and the cost of the beverage is the output

Please write this program in c++

C 1, C 2, and C3 are the user inputs, and the cost of the beverage is the output for the program.

image text in transcribedimage text in transcribed

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 ci C2 C3 O 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 0 1 1 $1 Invalid 1 1 0 0 Not available selection Invalid 1 1 1 0 Not available selection Example of the keypad: 12 INSTRUCTIONS B 13 14 1 For price of desired item press corresponding key 2 Price appears on display 3 Insert coins C5 6 D 17 18 # 9 110 Make selection on key pad 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. Array/vector must be used and an expected looping menu-driven of the keypad. 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 ci C2 C3 O 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 0 1 1 $1 Invalid 1 1 0 0 Not available selection Invalid 1 1 1 0 Not available selection Example of the keypad: 12 INSTRUCTIONS B 13 14 1 For price of desired item press corresponding key 2 Price appears on display 3 Insert coins C5 6 D 17 18 # 9 110 Make selection on key pad 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. Array/vector must be used and an expected looping menu-driven of the keypad

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions