subject
Computers and Technology, 07.05.2021 17:20 dvh

Write a program that simulates a vending machine. The machine holds six snack items labeled them 1 through 6. The program should initially display a menu of items along with their prices: Vending Machine
1. Roasted Almonds --> $1.25
2. Pretzels --> $1.75
3. Chewing Gum --> $0.90
4. Mints --> $0.75
5. Chocolate bar --> $1.50
6. Cookies --> $2.00
The program then should ask the user to enter the item to purchase along with a sum of money. If the money is enough to buy the item, your program should display the name of item purchased along with the change owed to the user (if any). If the money inserted is insufficient, then your program should say so and let the user know how much additional money is needed. Your program must display the money amounts using the dollar sign and two decimal places after the decimal point.
Please note that your program must validate the input given by the user:
The item to purchase an the amount of money are numeric values (e. g. int and float)
If the user enters an invalid choice for an item to purchase, your program should alert the user of the error.
The program should not accept negative values for the sum of money.
Here are a few sample runs:

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:00
What allows you to create a wireless connection among your smart devices
Answers: 2
question
Computers and Technology, 23.06.2019 03:30
Ihave a singular monitor that is a tv for my computer. recently, i took apart my computer and put it back together. when i put in the hdmi cord and booted the computer to see if it worked, the computer turned on fine but the screen was blue with "hdmi no signal." i've tried everything that doesn't require buying spare parts, any answer is appreciated!
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
The more powerful, 60 volt cables and the main power shut off on an hev are both colored orange
Answers: 1
question
Computers and Technology, 24.06.2019 06:30
Adrawing that places all lines parallel to the z axis at an angle from the horizon is 99 ! a. an oblique drawing b. a perspective drawing c. an auxiliary view d. a one-point perspective drawing
Answers: 2
You know the right answer?
Write a program that simulates a vending machine. The machine holds six snack items labeled them 1 t...
Questions
question
Biology, 20.05.2021 01:10
question
English, 20.05.2021 01:10
question
Mathematics, 20.05.2021 01:10
Questions on the website: 13722367