Build-A-Burger DOCKET ALGORITHM (with a couple of approaches)
(varying efficiencies)
BEGIN
INPUT bun
INPUT protein
INPUT salad
INPUT cheese
INPUT pickles
INPUT hotsauce
INPUT ketchup
INPUT mayo
INIT bill = 0
IF (bun = 1) THEN
CALCULATE bill = bill + 1
OUTPUT 'White Plain'
OUTPUT '$1.00'
ELSEIF bun = 2 THEN
CALCULATE bill = bill + 1
OUTPUT 'White Seeded'
OUTPUT '$1.00'
ELSEIF bun = 3 THEN
CALCULATE bill = bill + 1.2
OUTPUT 'Wholemeal Seeded'
OUTPUT '$1.20'
ELSEIF bun = 4
CALCULATE bill = bill + 1.2
OUTPUT 'Multigrain Seeded'
OUTPUT '$1.20'
ELSEIF bun = 5
CALCULATE bill = bill + 1.8
OUTPUT 'Sourdough Plain'
OUTPUT '$1.80'
ELSEIF bun = 6
CALCULATE bill = bill + 1.8
OUTPUT 'Sourdough Seeded'
OUTPUT '$1.80'
ELSEIF bun = 7
CALCULATE bill = bill + 2.1
OUTPUT 'Gluten Free'
OUTPUT '$2.10'
ELSE
OUTPUT 'No bun'
OUTPUT '$0.00'
ENDIF
INIT proteins = [['None',0],
['Beef Patty',1],
['Double Beef Patty',2],
['Wagyu Beef Patty',3.2],
['Chicken Schnitty',2.5],
['Pulled Pork',4.8],
['Jerked Chicken',4.2],
['Crispy Marinated Tofu',4.9]]
CALCULATE bill = bill + proteins[protein,1]
OUTPUT proteins[protein,0]
OUTPUT proteins[protein,1]
INIT salads = [['None',0],
['Mixed greens',0],
['Classic slaw',1],
['Macaroni Cheese',2.5]]
CALCULATE bill = bill + salads[salad,1]
OUTPUT salads[salad,0]
OUTPUT salads[salad,1]
INIT addons = [['Cheese',0.5],
['Pickles',0.3],
['Sriracha',0.2],
['Ketchup',0.1],
['Mayonaise',0.1]]
IF cheese THEN
CALCULATE bill = bill + addons[0,1]
OUTPUT addons[0,0]
OUTPUT addons[0,1]
ENDIF
IF pickles THEN
CALCULATE bill = bill + addons[1,1]
OUTPUT addons[1,0]
OUTPUT addons[1,1]
ENDIF
IF hotsauce THEN
CALCULATE bill = bill + addons[2,1]
OUTPUT addons[2,0]
OUTPUT addons[2,1]
ENDIF
IF ketchup THEN
CALCULATE bill = bill + addons[3,1]
OUTPUT addons[3,0]
OUTPUT addons[3,1]
ENDIF
IF mayo THEN
CALCULATE bill = bill + addons[4,1]
OUTPUT addons[4,0]
OUTPUT addons[4,1]
ENDIF
OUTPUT bill
END
Variables
bun, protein, salad : integer (0..7)
cheese, pickles, hotsauce, ketchup, mayo : boolean
bill : real (currency)