title "BillCalc"
fo.
100
x=10
c.
in. "Enter Bill Subtotal  ";a!
if a!=0 th. g. 550
c.
in. "Enter Tax Rate ";b!
if b!=1 th. g. 500
if b!=0 th. b!=8.5
c.
REM calculate/round tax
d!=(0.01*b!)*a!
d!=100*d!
y!=dint! d!
if y!<0.0 th. g. 105
z!=d!-y!
if z!<0.5 th. z!=0
if z!=0.5 th. z!=1
if z!>0.5 th. z!=1
d!=y!+z!
105
d!=0.01*d!
110
REM convert tax rate
c!=0.01*b!
REM calculate subtotal
e!=a!+d!
REM calculate/round 15% tip
f!=0.15*e!
f!=100*f!
y!=dint! f!
if y!<0.0 th. g. 115
z!=f!-y!
if z!<0.5 th. z!=0
if z!=0.5 th. z!=1
if z!>0.5 th. z!=1
f!=y!+z!
115
f!=0.01*f!
p. "15% Tip $";f!
in. "Enter Tip Amount ";f!
c.
REM calculate/round tip %
g!=f!/e!
h!=1000*g!
y!=dint! h!
if y!<0.0 th. g. 120
z!=h!-y!

if z!<0.5 th. z!=0
if z!=0.5 th. z!=1
if z!>0.5 th. z!=1
h!=y!+z!
120
h!=0.1*h!
REM calculate total
i!=e!+f!
130
c.
p. "Bill Total  $"; i!
p.
p.
p. "Subtotal"
p. "$";a!
p.
p. "Tax (";b!;"%)"
p. "$";d!
p.
p. "Subtotal"
p. "$";e!
p.
p. "Tip (";h!;"%)"
p. "$";f!
Pa.
if x=0 th. g. 300
REM create diner loop
150
c.
for w=1 to 5
p. "Enter Diner ";w;" Amount(s)"
p.
200
in. "$";j!
k!=j!+k!
if k!=0 th. g. 300
if j!=0 th. g. 250
g. 200
250
c.
REM round diner subtotal
k!=100*k!
y!=dint! k!
if y!<0.0 th. g. 255
z!=k!-y!
if z!<0.5 th. z!=0
if z!=0.5 th. z!=1
if z!>0.5 th. z!=1
k!=y!+z!
255
k!=0.01*k!
REM calculate/round diner tax
l!=c!*k!
l!=100*l!
y!=dint! l!
if y!<0.0 th. g. 260
z!=l!-y!
if z!<0.5 th. z!=0
if z!=0.5 th. z!=1
if z!>0.5 th. z!=1
l!=y!+z!
260
l!=0.01*l!
REM calculate diner subtotal
m!=k!+l!
REM calculate/round diner tip
n!=g!*m!
n!=100*n!
y!=dint! n!
if y!<0.0 th. g. 265
z!=n!-y!
if z!<0.5 th. z!=0
if z!=0.5 th. z!=1
if z!>0.5 th. z!=1
n!=y!+z!
265
n!=0.01*n!
REM calculate diner total
o!=m!+n!
c.
If w=1 th. p. "Diner 1  $";o!
If w=2 th. p. "Diner 2  $";o!
If w=3 th. p. "Diner 3  $";o!
If w=4 th. p. "Diner 4  $";o!
If w=5 th. p. "Diner 5  $";o!
p.
p.
p. "Subtotal"
p. "$";k!
p.
p. "Tax (";b!;"%)"
p. "$";l!
p.
p. "Subtotal"
p. "$";m!
p.
p. "Tip (";h!;"%)"
p. "$";n!
pa.
REM fill diner totals
If w=1 th. p!=o!
If w=2 th. q!=o!
If w=3 th. r!=o!
If w=4 th. s!=o!
If w=5 th. t!=o!
cl. j!
cl. k!
cl. o!
if w=5 th. g. 300
c.
n.
300
REM calculate diner total
u!=p!+q!+r!+s!+t!
300
c.
p. "Diner / Bill Total"
p. "$";u!;" / $";i!
p.
p.
p. "Diner 1"
p. "$";p!
if q!>0 th. p.
if q!>0 th. p. "Diner 2"
if q!>0 th. p. "$";q!
if r!>0 th. p.
if r!>0 th. p. "Diner 3 "
if r!>0 th. p. "$";r!
if s!>0 th. p.
if s!>0 th. p. "Diner 4"
if s!>0 th. p. "$";s!
if t!>0 th. p.
if t!>0 th. p. "Diner 5"
if t!>0 th. p. "$";t!
pa.
400
c.
p. "Enter to Navigate"
p.
p. "0 Bill Total Details"
in. "1 Diner Amount Entry ";x
if x=0 th. g. 120 
if x=1 th. g. 510
pa.
500
c.
in. "Enter Tax Amount ";d!
b!=d!/a!
b!=1000*b!
y!=dint! b!
if y!<0.0 th. g. 505
z!=b!-y!
if z!<0.5 th. z!=0
if z!=0.5 th. z!=1
if z!>0.5 th. z!=1
b!=y!+z!
505
b!=0.1*b!
c.
g. 110
510
cl. p!
cl. q!
cl. r!
cl. s!
cl. t!
g. 150
550
c.
p. "Notes"
p.
p.
p. "Enter 0 or tap screen to"
p. "continue."
p.
p. "Enter 0 as Tax Rate to"
p. "use preset rate."
p.
p. "Enter 1 as Tax Rate to"
p. "enter $ instead of %."
p.
p. "Use calculator screen to"
p. "calculate."
p.
p. "Heed minor discrepencies"
p. "resulting from rounding."
pa.
g. 100

