subject
Computers and Technology, 06.06.2020 23:03 bbb4951

Calculating change is something that we have been trained to do from a young age. For example, without thinking about it, we all know how many quarters, dimes, nickels and pennies we should receive if the change from our purchase is 47 cents. In this lab, you will write a program to convert a given amount of money (in cents) into change. Notice, however, that there are many ways to calculate change. That is, if our change is 47 cents, we could use 47 pennies. Or we could use 3 dimes and 17 pennies. Or we could use 4 dimes, a nickel, and 2 pennies. You get the idea. What we would really like to do is use a minimal number of coins. For 47 cents, one way to use a minimal number of coins is 1 quarter, 2 dimes, and 2 pennies.
For this lab, you will implement a greedy solution for the problem of calculating change. What is a greedy solution? It is quite simple. Assume you want to convert an arbitrary number of cents into coins of the following denominations: dollar, half-dollar, quarter, dime, nickel, and penny. Use as many dollar coins as possible; then, on what's left over, use as many half-dollar coins as possible; then again as many quarters as possible; then as many dimes as possible; then as many nickels as possible; finally the remainder is in pennies.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 18:00
What can a word user do with the customize ribbon dialog box? check all that apply. minimize the ribbon add a new tab to the ribbon remove a group from a tab add a group to a tab choose which styles appear choose which fonts appear choose tools to appear in a group
Answers: 1
question
Computers and Technology, 23.06.2019 22:00
Technician a says engine assemblies can be mounted longitudinally in a chassis. technician b says engine assemblies can be mounted transversely in a chassis. who is correct?
Answers: 2
question
Computers and Technology, 24.06.2019 14:30
In a home that has 120 v service, there is an electric appliance that has a resistance of 12 ohms. how much power will this appliance consume? a. 10 w b. 120 w c 1200 w d. 1440 w
Answers: 1
question
Computers and Technology, 24.06.2019 16:30
Which program can damage your computer?
Answers: 1
You know the right answer?
Calculating change is something that we have been trained to do from a young age. For example, witho...
Questions
question
Mathematics, 22.08.2019 03:40
Questions on the website: 13722359