Question: 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 arepaying (this simulates them actually inserting cash). If the money collected is

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!