Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How do i do this?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
jhdho0204




PostPosted: 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
BooHoo
Sponsor
Sponsor
Sponsor
sponsor
Srlancelot39




PostPosted: 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?
DemonWasp




PostPosted: 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.
Kloyd Niel




PostPosted: 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
DanShadow




PostPosted: 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: