Posted: 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!!
Posted: Tue May 27, 2003 7:04 pm Post subject: (No 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.
Posted: Tue May 27, 2003 7:10 pm Post subject: (No 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
Posted: Tue May 27, 2003 7:12 pm Post subject: (No subject)
Actually i just cant get it to display the change part.
Posted: Tue May 27, 2003 8:07 pm Post subject: (No 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?
Posted: Tue May 27, 2003 8:19 pm Post subject: (No subject)
Heres my code so far. Please correct because i cant figure it out!
put "Please Select one of the following main courses"
put "A = Hamburger"
put "B = Cheeseburger"
put "C = Chicken Burger"
put "D = Submarine"
put "E = Salad"
exit when main = A or main = B or main = or main = D or main = E
put "please select one of the following side dishes"
put "F = 2 Cookies"
put "G = Fries"
put "H = Pasta"
put "I = Mashed Potato's"
put "J = Baked Potatoes"
exit when side = F or side = G or side = H or side = I or side = J
put "please select a drink"
put "K = Pop"
put "L = Chocolate Milk"
put "M = Gatoraid/Poweraid"
put "N = Bottled Water"
put "O = Slush Puppy"
exit when drink = K or drink = L or drink = M or drink = N or drink = O
put "Your total comes to ",total
put "What bill will you use to pay for this?"
if (change>1000) then
exit when change < 1000
put "you will need ",tens," tens"
if (change>500) then
exit when change < 500
put "you will need ",fives," fives"
if (change>200) then
exit when change < 200
put "You will need ",toonies," toonies"
exit when change < 100
put "You will need ",loonies," loonies"
if (change>25) then
exit when change < 25
put "You will need ",quarters," quarters"
if (change>10) then
exit when change < 10
if (change>5) then
exit when change < 5
put "You will need ",nickles," nickles"
if (change > 1) then
exit when change < 1
put "You will need ",pennys," pennys"
Posted: Tue May 27, 2003 8:34 pm Post subject: (No subject)
why do the foods cost hundreds??!?!?!?!?
Posted: Tue May 27, 2003 8:35 pm Post subject: (No subject)