Question
Write a Java program that lets the user buy a drink from a vending machine. The Machine has three drinks available: Coke: $2.41 Red Bull:
Write a Java program that lets the user buy a drink from a vending machine. The Machine has three drinks available: Coke: $2.41 Red Bull: $4.63 Water: $1.11 The user will first pick a drink, then the user will be told how much they owe. Then the user enters how much they pay. Calculate how much money the machine should return to the user, and then calculate the smallest possible amount of bills and coins to return to the user. For example, the user buys a coke and pays $5. The machine should return to the user two $1 bills, two quarters, a dime, and four 1c pieces. (total of $2.59)
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