Computer Science Canada

Cash Register

Author:  - IzAk - [ Tue Jun 06, 2006 11:05 am ]
Post subject:  Cash Register

code:
var gst, pst, cost, total, cash, grat : real
put "=============================================="
put "| Welcome to J's Cash Register Program!  |"
put "=============================================="
put "Please enter the amount of your item: " ..
get cost
put "=============================================="
gst := cost * .08
pst := cost * .07
grat := cost * .17
put "Gst: $", gst
put "Pst: $", pst
put "Grat: $", grat
put "Tax Total: $", gst + pst
total := cost + gst + pst + grat
put "Grand Total is: $", total
put "=============================================="
put "Please enter your amount of cash: $" ..
get cash
cash := total - cash
put "=============================================="
total := cost + gst + pst + grat
cash := total - cash
if total >= cash then
    put "Not enough money get moving: $", cash - total
elsif cash >= total then
    put "Your change is: $", cash - total
end if
put "=============================================="
put "Thanks for using J's Cash Register Program"
put "=============================================="

Author:  jamonathin [ Tue Jun 06, 2006 4:44 pm ]
Post subject: 

I would never return to your store. A tip (gratuity) is what you feel the person deserves, not what is required.

Author:  Clayton [ Tue Jun 06, 2006 4:57 pm ]
Post subject: 

hm read the stickies in each forum, at the top of the forum here it clearly states that these kinds of programs arent needed to be posted (that is to say ones that are programmed in no more than 5 minutes)

Author:  Remm [ Tue Jun 06, 2006 6:18 pm ]
Post subject: 

Agreed. These programs are made in bulk throughout the schoolyear for assesment, i have a good 15 or so. Go more creative and out-of-the-curiculum.

Meh. Nice regester tho. I have one I did for marks and its horrible in comparrison. lol. teacher didint like that she couldnt tell what variables did what (i had one named cheese, ect...)

Author:  - IzAk - [ Wed Jun 07, 2006 12:21 pm ]
Post subject: 

man im glad oner person had something decent to say

Author:  BlackDragon989 [ Wed Jun 14, 2006 1:17 pm ]
Post subject: 

wow your store is poor if they gotta use turnin to get totals..... lmao jk jk sick... its better than mine, mine was like 50+ lines.. lmao

Author:  rownale [ Wed Jun 14, 2006 4:42 pm ]
Post subject: 

Nice looking but I dont think it works properly
If you enter $1 for the item it says ur tax is 15 cents but ur grand total becomes 1.32...
code:

total := cost + gst + pst + grat

should become
code:

total := cost + gst + pst

Author:  _justin_ [ Wed Jun 14, 2006 4:48 pm ]
Post subject: 

accutly the assigenmt said we had to add .17 tip so thats why it comes out greater then what the total should be

Author:  BenLi [ Wed Jun 14, 2006 8:15 pm ]
Post subject: 

pretty good, you can try first asking for how many itmes they have and using that value for a for loop. That way you can calculate multiple items

Author:  - IzAk - [ Thu Jun 15, 2006 12:28 pm ]
Post subject: 

never thought of that, thnx...

Author:  - IzAk - [ Thu Jun 15, 2006 1:26 pm ]
Post subject: 

wanna give me some tips on how to do that...

Author:  Clayton [ Thu Jun 15, 2006 2:46 pm ]
Post subject: 

put a loop around the whole thing, clear the screen at the top of the program, and initialize the variables back to default values at the start of the loop

Author:  - IzAk - [ Thu Jun 15, 2006 7:06 pm ]
Post subject: 

thnx, i'll take that as an option... again thnx for the support.

Author:  BenLi [ Thu Jun 15, 2006 9:46 pm ]
Post subject: 

it'll look something like this

code:

var n, cost, subtotal, total : int := 0

put "how many items?"
get n
for i : 1 .. n
    put "How much item ", i, " cost?"
    get cost
    subtotal += cost
end for
put "subtotal is ",subtotal
put "gst is ", subtotal * .08
put "pst is ", subtotal * .07
put "total is ", subtotal * 1.15

srry if code is non-working
i don't having turing on this comp

Author:  Anonymous [ Mon Jun 19, 2006 11:24 am ]
Post subject: 

There's nothing wrong with his program. The GUI is frendly, and it look's all nice. + bits

Author:  - IzAk - [ Mon Jun 19, 2006 12:43 pm ]
Post subject: 

thnx man

Author:  aldreneo [ Mon Jun 19, 2006 1:38 pm ]
Post subject: 

Works great!

I am making a nice mod of this which allows you to print receipts

Oh, and soon pst will be 6% so I changed that


: