Author |
Message |
- IzAk -
|
Posted: 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 "=============================================="
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
jamonathin
|
Posted: Tue Jun 06, 2006 4:44 pm Post subject: (No subject) |
|
|
I would never return to your store. A tip (gratuity) is what you feel the person deserves, not what is required. |
|
|
|
|
|
Clayton
|
Posted: Tue Jun 06, 2006 4:57 pm Post subject: (No 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) |
|
|
|
|
|
Remm
|
Posted: Tue Jun 06, 2006 6:18 pm Post subject: (No 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...) |
|
|
|
|
|
- IzAk -
|
Posted: Wed Jun 07, 2006 12:21 pm Post subject: (No subject) |
|
|
man im glad oner person had something decent to say |
|
|
|
|
|
BlackDragon989
|
Posted: Wed Jun 14, 2006 1:17 pm Post subject: (No 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 |
|
|
|
|
|
rownale
|
Posted: Wed Jun 14, 2006 4:42 pm Post subject: (No 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
|
|
|
|
|
|
|
_justin_
|
Posted: Wed Jun 14, 2006 4:48 pm Post subject: (No subject) |
|
|
accutly the assigenmt said we had to add .17 tip so thats why it comes out greater then what the total should be |
|
|
|
|
|
Sponsor Sponsor
|
|
|
BenLi
|
Posted: Wed Jun 14, 2006 8:15 pm Post subject: (No 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 |
|
|
|
|
|
- IzAk -
|
Posted: Thu Jun 15, 2006 12:28 pm Post subject: (No subject) |
|
|
never thought of that, thnx... |
|
|
|
|
|
- IzAk -
|
Posted: Thu Jun 15, 2006 1:26 pm Post subject: (No subject) |
|
|
wanna give me some tips on how to do that... |
|
|
|
|
|
Clayton
|
Posted: Thu Jun 15, 2006 2:46 pm Post subject: (No 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 |
|
|
|
|
|
- IzAk -
|
Posted: Thu Jun 15, 2006 7:06 pm Post subject: (No subject) |
|
|
thnx, i'll take that as an option... again thnx for the support. |
|
|
|
|
|
BenLi
|
Posted: Thu Jun 15, 2006 9:46 pm Post subject: (No 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 |
|
|
|
|
|
Guest
|
Posted: Mon Jun 19, 2006 11:24 am Post subject: (No subject) |
|
|
There's nothing wrong with his program. The GUI is frendly, and it look's all nice. + bits |
|
|
|
|
|
|