Computer Science Canada Need help with a food program in turing |
Author: | Miko99 [ Tue May 27, 2003 7:02 pm ] |
Post subject: | Need help with a food program in turing |
Ok. I have been struggling with this. I need to make a program that allows the user to buy their lunch. They pick from a menu what they want and then the computer spits out what their Bill is. They type in the size of the bill they will use ($50,$20,$10,$5 etc.) and the computer calculates how much change you will get. It tells the exact number of quarters, dollars, toonies, dimes, nickles, penny's, 5's, 10's (you get the point lol) that you will need. I need help with this. PLEASE HELP!! |
Author: | Asok [ Tue May 27, 2003 7:04 pm ] |
Post subject: | |
ok general rule of thumb. If your asking for help we have to assume you've done some work on it as such post your code. No one here is going to write the entire program for you. On top of that, this is probably an assignment, handing someone elses work in is considered plagerism and will not be tollerated. |
Author: | Tony [ Tue May 27, 2003 7:10 pm ] |
Post subject: | |
some sujestions though... use arrays to store your lists of food items and another array for prices... have a variable to count the total... as for the change, its same as converting numbers to binary... find the largest change(or even bill) you can fit in the remainder of the change to give out, untill you get down to pennies. such as for $1.67 its $1, 2 $0.25, $0.1, $0.05, 2 $0.01 |
Author: | Miko99 [ Tue May 27, 2003 7:12 pm ] |
Post subject: | |
Actually i just cant get it to display the change part. |
Author: | void [ Tue May 27, 2003 8:07 pm ] |
Post subject: | |
easy...use mod..what does the bill minus price equal?...take that...mod it by 2 (toonies), then subtract that number times two from the change, then mod it by 1 and repeat until you reach 0.01...then you will be done...understand? |
Author: | Miko99 [ Tue May 27, 2003 8:19 pm ] | ||
Post subject: | |||
Heres my code so far. Please correct because i cant figure it out!
|
Author: | void [ Tue May 27, 2003 8:34 pm ] |
Post subject: | |
why do the foods cost hundreds??!?!?!?!? |
Author: | Tony [ Tue May 27, 2003 8:35 pm ] |
Post subject: | |
maybe he's from russia |
Author: | void [ Tue May 27, 2003 8:40 pm ] |
Post subject: | |
lolz...i dont think russia uses toonies.... |
Author: | Tony [ Tue May 27, 2003 8:43 pm ] |
Post subject: | |
no, its the exchange rate... its something like $1 = 20 rubles... so a 100 is $5... hmm... you can buy a submarine for $25... ya, he must be from russia |
Author: | JSBN [ Tue May 27, 2003 8:44 pm ] |
Post subject: | |
That better be the best damn burger & cookies that i ever had |
Author: | void [ Tue May 27, 2003 8:51 pm ] |
Post subject: | |
LMFAO how do u use strint? |
Author: | Tony [ Tue May 27, 2003 9:00 pm ] | ||
Post subject: | |||
|
Author: | Miko99 [ Tue May 27, 2003 9:04 pm ] |
Post subject: | |
i know this is all funny but it really doesn't help. lol. the food will be divided by 100 when i print the total out. |
Author: | Homer_simpson [ Tue May 27, 2003 9:05 pm ] |
Post subject: | |
hehe i remeber doing the exact program a long time ago(5-6 years ago) but u wouldn't pick from any menu... u'd enter the price and the bill...i did it with turbo pascal(Oh memories =Þ) |
Author: | void [ Tue May 27, 2003 9:09 pm ] |
Post subject: | |
long live pascal |
Author: | void [ Tue May 27, 2003 9:22 pm ] | ||
Post subject: | |||
i think this is what your looking for mr.im too lazy to try...
if that doesnt work....your loss not mine |
Author: | Miko99 [ Tue May 27, 2003 10:10 pm ] |
Post subject: | |
awwww u hurt my feelings....for a second...until i realise its true. and by the way, i dont like your driving so i plan on staying off my lawn! LoL |
Author: | void [ Wed May 28, 2003 7:49 am ] |
Post subject: | |
dont try to get on my good side...you ruined our perfectly fine pointless topic... |
Author: | Miko99 [ Tue Jun 03, 2003 9:53 am ] | ||
Post subject: | |||
How do i get this to be continuous. The user will select there choices as much as they want and the price will continue to ad up. My code so far thanks to void:
|
Author: | w0lv3rin3 [ Tue Jun 03, 2003 8:41 pm ] | ||||
Post subject: | |||||
I'm looking @ this code, what does 21 and 0 : 2 do witin the code
also here what does 23, 0 : 2, and in put "TOTAL:" : 22, total : 0 : 2, where u see 22, total : 0 : 2, whats those numbers their for?
|
Author: | Tony [ Tue Jun 03, 2003 9:15 pm ] |
Post subject: | |
alignment... :number after a string sets the minimum size string has to be and adds spaces to output to match that number, so you can have preaty looking columns... second :number sets presision of real values (desimal places) |
Author: | Miko99 [ Wed Jun 04, 2003 1:01 pm ] |
Post subject: | |
Well how do i get that code to loop over and over and the total continusely adds up and is displayed at the end, with the exact coins they will get back. |
Author: | krishon [ Wed Jun 04, 2003 1:36 pm ] |
Post subject: | |
just put a loop around everything |
Author: | Miko99 [ Mon Jun 09, 2003 8:02 am ] |
Post subject: | |
Tried it, and id didn't work. |
Author: | Andy [ Mon Jun 09, 2003 8:06 am ] |
Post subject: | |
turing's mod is screwed up, there is a rounding error |
Author: | Grey_Wolf [ Mon Jun 09, 2003 3:42 pm ] | ||
Post subject: | |||
This code should loop it forever although i would suggest asking the user if they wish to continue. |
Author: | Miko99 [ Wed Jun 11, 2003 9:22 am ] |
Post subject: | |
That code doesn't keep everything the user selects in memory. I need it to keep everything. so i fi select 6 things, then i get charged for 6 things. |
Author: | Miko99 [ Thu Jun 12, 2003 7:48 am ] |
Post subject: | |
can someone please tell me how to get the food program to loop and continuesly add up the prices no matter how much food i select. |