Write a program that determines the change given back to a customer in a self-service checkout machine

Question:

Write a program that determines the change given back to a customer in a self-service checkout machine of a supermarket for purchases of up to $50. The program generates a random number between 0.01 and 50.00 and displays the number as the amount to be paid. The program then asks the user to enter payment, which can be one $1 bill, one $5 bill, one $10 bill, one $20 bill, or one $50 bill. If the payment is less than the amount to be paid, an error message is displayed. If the payment is sufficient, the program calculates the change and lists the bills and/or the coins that make up the change, which has to be composed of the least number each of bills and coins. For example, if the amount to be paid is $2.33 and a $10 bill is entered as payment, then the change is one $5 bill, two $1 bills, two quarters, one dime, one nickel, and two pennies. Execute the program three times.
Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: