Computer Science Canada How do i do this? |
Author: | jhdho0204 [ Tue Sep 28, 2010 5:43 pm ] |
Post subject: | How do i do this? |
How do i write a program that ask users for a amount then output the number of tonnies, loonies, quarters, dimes, nickels and pennies that form that amount ![]() |
Author: | Srlancelot39 [ Tue Sep 28, 2010 6:19 pm ] |
Post subject: | RE:How do i do this? |
do you need the program to output all possible combinations? or just the most logical eg. max out toonies, then max out loonies, then the next biggest etc? |
Author: | DemonWasp [ Tue Sep 28, 2010 6:27 pm ] |
Post subject: | RE:How do i do this? |
Try working through an example on your own. Use paper and pencil, NOT computer or calculator. Think carefully about what you do at each step. For example, take the amount $14.92. You know that you'd most likely receive this as: $10 + 2 toonies + 3 quarters + 1 dime + 1 nickel + 2 pennies. Work through it like this: A) $14.92 contains at most ONE $10 bill. Select the $10 bill; now you only need to deal with $4.92. B) $4.92 contains at most TWO $2 coins. Select 2 $2 coins; now you only need to deal with $0.92. C) $0.92 contains at most THREE quarters. Select ... deal with $0.17. D) ... (fill in the blanks) Next, form a set of steps to do that. Word them in English. Try your example again, following the steps exactly. Fix up your instructions where you've made mistakes. Once you have a working instruction list, you can translate that into Turing (or whatever language). This last part is the easiest part. |
Author: | Kloyd Niel [ Tue Oct 12, 2010 1:30 am ] |
Post subject: | Re: How do i do this? |
Hello Guys, Thanks for the information that i read, BTW im a newly one in this site but i learned lot of ideas about this site. Thanks a lot for being part of this site. God Bless. how to treat depression |
Author: | DanShadow [ Tue Oct 12, 2010 2:35 am ] |
Post subject: | RE:How do i do this? |
If your interested in more (similar) information, here is a very similar post, with a very similar question. http://compsci.ca/v3/viewtopic.php?p=221951#221951 |