subject

Write a function that will help a vending machine return the most efficient change in coins possible when given a sales price and a payment. For example, if a sales price is $0.20 and a customer gives the machine a $1 bill, then your function should return $0.80 in change. More specifically, the function should return the $0.80 as 3 quarters and 1 nickel, because that's the most efficient (that is, it uses the fewest number of coins).
Here are the following types of U. S. coins that the vending machine can use for returning change:
Pennies: $0.01
Nickels: $0.05
Dimes: $0.10
Quarters: $0.25
Input Variable:
Your input variables will be an item price and a payment array with all of the monetary inputs into the machine that must be added together to compute the total payment. For example, the payment array which simulates the customer inputting a quarter, dime, and dollar for a total payment of $1.35 may look like:
[0] 0.25
[1] 0.10
[2] 1.00

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:50
Farah works in an office with two other employees. all three share a printer and an internet connection. the utility that makes this possible is defragger quicktime soho winzip
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
Which component acts as a platform on which application software runs
Answers: 2
question
Computers and Technology, 24.06.2019 20:00
Individuals suffering from technology overload feel distressed when deprived of computers and mobile devices.true/fasle
Answers: 2
question
Computers and Technology, 24.06.2019 20:20
Write python code that prompts the user to enter his or her age and assigns the user’s input to an integer variable named age.
Answers: 1
You know the right answer?
Write a function that will help a vending machine return the most efficient change in coins possible...
Questions
question
Mathematics, 12.05.2021 04:10
question
Computers and Technology, 12.05.2021 04:10
question
Social Studies, 12.05.2021 04:10