Vrite 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 $20. The program generates a random number between 0.01 nd 20.00 and displays the number as the amount to be paid. The program then asks the user to enter ayment, which can be one $1 bill, one $5 bill, one $10 bill, or one $20 bill. If the payment is less than he amount to be paid, an error message is displayed. If the payment is sufficient, the program calculates he change and lists the bills and/or the coins that make up the change, which has to be composed of he 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 wo pennies Execute the program three times

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Use matlab to determine the answer. Use the function file then call the function to get the answer in a script file.

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 $20. The program generates a random number between 0.01
and 20.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, or one $20 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.
Transcribed Image Text: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 $20. The program generates a random number between 0.01 and 20.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, or one $20 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.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education