Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++ create the following code for a vending machine: The vending machine will have 4 inputs and will dispense at amounts of 30, 35,

Using C++ create the following code for a vending machine:

The vending machine will have 4 inputs and will dispense at amounts of 30, 35, 40, 45 and 50 cents.

q for quarters which = 25

d for dimes which = 10

n for nickels which = 5

d for dispense

the code will have a running state of the user input.

the vending machine can also not accept a value lower than the previous amount, so if the user inputs a quarter they can not input a nickel or a dime again.

once the amount reaches 30, 35, 40, 45 or 50 cents the user can put in the state d to dispense the soda.

image text in transcribed

Welcome to the Candy Machine! Running, state is 0 Input: d Running, state is 10 Input: q Running, state is 35 Input: q Invalid input Running, state is 35 Input: n Invalid input Running, state is 35 Input: s Dispensing Soda Running, state is 0 Input

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

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions

Question

=+3. Who is responsible for this project?

Answered: 1 week ago

Question

Discuss all branches of science

Answered: 1 week ago