subject

Write a program that simulates the functionality of a vending machine having the following characteristics:• The vending machine offers 5 products• The vending machine accepts coins, 1 dollar bills, and 5 dollar bills• The change is always given in coins, with maximum possible number of coins in each value: 25, 10, 5 or 1 cent.• The selections available for user are numbers from 1 to 5.• The user enters the money – simulate the action through a loop that ends when the user enters 0. Each coin, or paper bill will be read individually.• The user makes the selection, and the machine allows a maximum 4 other selections if the amount entered doesn’t cover the price of the item.• Once an item is delivered, the machine gives the change in coins.• There is no increment for the money during one selection.• The user can stop the selection at any time by entering 0 for the product selection.• If the user chooses to cancel the selection, the machine returns the initial amount in coins.• Display the outcome of the operation for each alternative you consider possible for the vending machine.• Make sure that the machine returns the correct change at all times.

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:00, ed72018373
Which law requires employers to provide safe working environments for their employees? a. civil rights act b. fair labor standards act c. occupational safety and health act d. wagner act
Answers: 1
image
Computers and Technology, 22.06.2019 18:30, Liantic8738
List the five on-board vehicle subsystems
Answers: 1
image
Computers and Technology, 22.06.2019 19:20, ChaosMind
Write a program that reads a file consisting of students’ test scores in the range 0–200. it should then determine the number of students having scores in each of the following ranges: 0–24, 25–49, 50–74, 75–99, 100–124, 125–149, 150–174, and 175–200. output the score ranges and the number of students. (run your program with the following input data: 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 35, 157, 189.)
Answers: 3
image
Computers and Technology, 23.06.2019 07:00, bskyeb14579
Why is investing in a mutual fund less risky than investing in a particular company's stock? a. mutual funds only invest in blue-chip stocks. b. investments in mutual funds are more liquid. c. mutual funds hold a diversified portfolio of stocks. d. investments in mutual funds offer a higher rate of return.
Answers: 2
You know the right answer?
Write a program that simulates the functionality of a vending machine having the following character...

Questions in other subjects:

Konu
Mathematics, 07.01.2021 14:00
Konu
History, 07.01.2021 14:00