In a store, you want to give change to customers and only have coins of the following types: 25 cents, 10 cents, 5 cents, and 1 cent. Write a Python function called currency (n) to calculate the minimum number of coins the cashier can donate, or n is a real (float). The function takes as input in parameter the value n in dollars. Use the following algorithm: multiply the dollar value with 100 to turn it into cents (pennies). Next, calculate the possible number of 25-cent coins. If there is a remainder, calculate the number of dimes, then 5 cents, and finally 1 cent, if necessary. The function should display the number of 25 cents, 10 cents, 5 cents, and 1 cent coins, as shown in the photo. And at the end the function should return the minimum total number of parts, which is an integer (int). Use modulo and integer division for calculations. Examples: If the cashier has to return $ 0.56, the minimum number of coins is 4 (2 coins of 25 cents, 0 10 cents, 15 cents and 1 1 cent). It is not possible to give 3 pieces (or less) so the minimum number in this case is 4. - If the amount to be returned is $ 1.42, the minimum number of coins is 9 (5 coins of 25 cents, 1 10-cent coin, 1 5-cent coin and 2 1-cent coins).
In a store, you want to give change to customers and only have coins of the following types: 25 cents, 10 cents, 5 cents, and 1 cent. Write a Python function called currency (n) to calculate the minimum number of coins the cashier can donate, or n is a real (float). The function takes as input in parameter the value n in dollars. Use the following algorithm: multiply the dollar value with 100 to turn it into cents (pennies). Next, calculate the possible number of 25-cent coins. If there is a remainder, calculate the number of dimes, then 5 cents, and finally 1 cent, if necessary. The function should display the number of 25 cents, 10 cents, 5 cents, and 1 cent coins, as shown in the photo. And at the end the function should return the minimum total number of parts, which is an integer (int). Use modulo and integer division for calculations. Examples: If the cashier has to return $ 0.56, the minimum number of coins is 4 (2 coins of 25 cents, 0 10 cents, 15 cents and 1 1 cent). It is not possible to give 3 pieces (or less) so the minimum number in this case is 4. - If the amount to be returned is $ 1.42, the minimum number of coins is 9 (5 coins of 25 cents, 1 10-cent coin, 1 5-cent coin and 2 1-cent coins).
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
Related questions
Question
Please help I’m not understanding, also if you could explain the steps, thank you
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
Recommended textbooks for you
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education