Computer Science Canada Cash Register help |
Author: | osmanrulz [ Fri Nov 24, 2006 4:53 pm ] | ||
Post subject: | Cash Register help | ||
Erm iv written a a small cash register program, thats finds out the name of a restuarant and accepts the price for a meal and prints the bill. What i have been instructed is.. if the meal if over $5.00, i shud display a 7% sales tax. The program is assigned to work if several meals are entered for one bill, which i have trouble modifying, It should also work for several customers (different bills). Now I only have been close to the midterm of my programming class and all i know is loops and selection, if statements and end statements and all the basic stuff. How can i make this program work for several meals entered for one bill, and then calculating that with a salestax or without it. This is what I have completed so far.
|
Author: | osmanrulz [ Fri Nov 24, 2006 5:10 pm ] |
Post subject: | |
oh and sorry I didnt post this in the first message, I also need to round the total to 2 decimal places, and i forgot how to do that ![]() |
Author: | ericfourfour [ Fri Nov 24, 2006 8:05 pm ] | ||
Post subject: | |||
Well Turing has a nifty round function that rounds off the decimals.
You want it to round to two decimal places so somehow you are going to have to move the decimal, round the number, and move the decimal back. |
Author: | DemonZ [ Sat Nov 25, 2006 2:56 am ] |
Post subject: | |
why not just use fields? same thing and simple heres an example put money:0:2 |
Author: | osmanrulz [ Sat Nov 25, 2006 9:52 am ] | ||
Post subject: | |||
DemonZ wrote: why not just use fields? same thing and simple heres an example
put money:0:2 yess thanks so much, so it should me something like this? , I still have this annoying error that keeps popping up when I enter an amound for my meal i.e 4.22 and I enter say 5.22 for my Bill, it gives me a no variable error. Also I would like to know how I can make it calculate and input/output multiple meals, using for statements, but I seem to be having trouble doing that. It should be something like this. put "How many meals would you like to order.." get numMeals put "What is the Price of meal 1?" put "What is the Price of meal 2?" ... etc
|