subject

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.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:30
The cm is responsible for overseeing the actions of the crisis management team and coordinating all crisis management efforts in cooperation with disaster recovery and/or business continuity planning, on an as-needed basis
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Which is the highest level of the hierarchy of needs model? a. humanity b. intrapersonal c. team d. interpersonal
Answers: 1
question
Computers and Technology, 23.06.2019 09:20
How to print: number is equal to: 1 and it is odd number number is equal to: 2 and it is even number number is equal to: 3 and it is odd number number is equal to: 4 and it is even number in the console using java using 1 if statement, 1 while loop, 1 else loop also using % to check odds and evens
Answers: 3
question
Computers and Technology, 23.06.2019 20:30
If chris has a car liability insurance, what damage would he be covered for
Answers: 1
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
Mathematics, 19.01.2020 15:31
question
Mathematics, 19.01.2020 15:31
question
Biology, 19.01.2020 15:31
question
English, 19.01.2020 16:31