Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Program 1: Write the money collection interface for the vending machine. Your program should tell the user the price of the item and then the
Program 1: Write the money collection interface for the vending machine. Your program should tell the user the price of the item and then the user will enter the amount of money that they are paying (this simulates them actually inserting cash). If the money collected is less than the price, print an appropriate message (such as: "Insufficient funds, no sale!") and then the program should exit. If enough money is collected, determine the amount to return to the customer. If the change due is not zero, tell the user how much change they will receive. Next print a message (such as "Thank you enjoy your drink!") and end the program normally (at the return 0 statement) Note, your program should be able to handle all amounts of money (not just multiples of dollars but also cents such as $1.25). Also you may assume that the user is only entering a number and not the$ (though the $ could be part of your prompt). Hint: Check how to do floating point comparisons
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