Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ program only Write a C++ program to accomplish the following: Your program presents the user with a choice of your favorite beverages. Then allow

C++ program only

Write a C++ program to accomplish the following:

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.

image text in transcribed

image text in transcribed

Write a C++ (or Java, etc.) program to accomplish the following: 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 C3are the logic inputs.

There are 8 possible truth values or 8 digital logics. Only 3 pairs are valid for 3 favorite beverages. The machine can hold maximum10 max drinks for each logic inputs.

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 logics. Only 3 pairs are valid for 3 favorite beverages. The machine can hold maximum 10 max drinks for each 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 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 Your program should operate continuously with a list of drinks and their costs displayed on the terminal. Example of the keypad: INSTRUCTIONS 1 For price of desired item press corresponding key 2 Price appears on display 3 Insert coins Make selection on key pad A12 B3 14 ICT5 T6 D17 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. Array/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 machine

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_2

Step: 3

blur-text-image_3

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

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

Students also viewed these Databases questions

Question

Consider this article:...

Answered: 1 week ago

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago