process STOP.SIM
''
'' AUTHOR: Steve Bailey
'' CREATED: 7-25-90
'' DESCRIPTION:
''     This process stops the simulation and prints out vital statistics.
''

define I as an integer variable
define GROSS, NET1, NET2 as a real variable

let GROSS = BURGERS.SOLD*BURGER.PRICE + SHAKES.SOLD*SHAKE.PRICE +
  FRIES.SOLD*FRY.PRICE
let NET1 = GROSS - (BURGERS.SOLD*.BURGER.COST + SHAKES.SOLD*.SHAKE.COST +
  FRIES.SOLD*.FRY.COST)
let NET2 = NET1 - ((N.KNAVE+N.ORDER.TAKER) * .EMPLOYEE.WAGE)

skip 2 lines
print 2 lines like this
			FAST FOOD SIMULATION RESULTS	
			---- ---- ---------- -------
skip 1 line

print 6 lines with 
    .NOW / 3600, TOTAL.CUSTOMERS, MEAN.WAITING.TIME / 60, 
    MOD.F(MEAN.WAITING.TIME, 60), MAX.WAITING.TIME / 60, 
    MOD.F(MAX.WAITING.TIME, 60), GROSS, NET2
like this
    The fast food simulation ended after **.* hours 
    The number of customers that were served was ***
    The average waiting time for food was ***:** minutes
    The maximum waiting time for food was ***:** minutes
    We grossed ***.** dollars
    After paying wages and costs we netted ***.** dollars

skip 1 line

print 2 lines like this
 The queues for the knaves were as follows:
 Knave       Average        Maximum        Utilization

skip 1 line

for I = 1 to N.KNAVE do
    print 1 line with 
      I, AVE.KNAVE.JOBS(I), MAX.KNAVE.JOBS(I), KNAVE.UTILIZATION(I) * 100
      like this
   **         **.*            **              **.*  Percent
loop

skip 1 line

print 2 lines like this
 The queues for the order takers were as follows:
 Order taker       Average        Maximum        Utilization

for I = 1 to N.ORDER.TAKER do
    print 1 line with 
      I, AVE.ORDER.TAKER.JOBS(I), MAX.ORDER.TAKER.JOBS(I), 
      ORDER.TAKER.UTILIZATION(I) * 100 like this
   **               **.*            **              **.*  Percent
loop

skip 1 line

print 2 lines like this
 The queues for the workstations were as follows:
 Workstation       Average        Maximum        Utilization

for I = 1 to N.WORKSTATION do
    print 1 line with 
      I, AVE.WORKSTATION.JOBS(I), MAX.WORKSTATION.JOBS(I), 
      WORKSTATION.UTILIZATION(I) * 100 like this
   **               **.*            **              **.*  Percent
loop

stop
end

