Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that simulates a vending machine. The program should display the message This is a vending machine - What is your selection? Then
Write a program that simulates a vending machine. The program should display the message "This is a vending machine What is your selection?" Then display the following menu.
a chocolate bar cents
b potato chips cents
a popcorn cents
b sweet tarts cents
Then display the message "Enter a coin:". This could be or
If the user entered the exact amount, then display message "Here is the
If the user entered more than required, then display message "Here is the and your change is
If the user entered less than what is required, then display message "Sorry, not enough money"
Compile and test your code. Submit your java file through Blackboard.
Notes:
For the selection the user only enters aba or b
is what the user selected.
is change from the coin that was entered.
Attach File
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started