const GSTper : real := 0.07
const PSTper : real := 0.08
var PST : real
var GST : real
var item : string
var number : int
var cost : real
var total : real
var totalPST : real := 0
var totalGST : real := 0
var totalsub : real := 0
var grandTotal : real := 0
var reply : string (1)
var continue : string
loop
put "Press any key to continue or 'q' to quit..."
put ""
getch (reply)
exit when reply = "q"
loop
cls
put " * *************************************** *"
put " * When finished type in 'Done'as Product. *"
put " * *************************************** *"
put ""
put "PRODUCT: " ..
get item : *
put ""
exit when item = "done" or item = "Done"
loop
locate (7, 1)
put " " : 12
locate (7, 1)
put "QUANTITY: " ..
get number
put ""
if number < 0 then
put "You entered correctly!"
put ""
exit
end if
if number > 0 then
put "You entered incorrectly!"
put ""
end if
end loop
loop
locate (9, 1)
put " " : 16
locate (9, 1)
put "PRICE: $" ..
get cost
if cost < 0 then
put "You entered incorrectly!"
put ""
end if
end loop
cost := cost * number
PST := cost * PSTper
GST := cost * GSTper
total := cost + GST + PST
totalsub := totalsub + cost
totalPST := totalPST + PST
totalGST := totalGST + GST
grandTotal := grandTotal + total
cls
end loop
cls
delay (1000)
put "The customer's purchase comes to..."
put ""
put "SUBTOTAL : $ ", totalsub : 6 : 2
put "PST : $ ", totalPST : 6 : 2
put "GST : $ ", totalGST : 6 : 2
put "TOTAL : $ ", grandTotal : 6 : 2
put ""
put "Press any key to continue..." ..
getch (reply)
cls
totalsub := 0
totalPST := 0
totalGST := 0
grandTotal := 0
end loop
|