%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Kartik's Restaurant Program
%Created: Oct 31, 2010
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
import GUI
var window : int := Window.Open ("noButtonBar") %Removes Buttonbar from output window
%Variables
var sideMeal : int
var mainMeal : int
var drinkSize : int
var drinkType : int
var discount : int := Rand.Int (1, 3)
var sideMealCost : real
var mainMealCost : real
var drinkCost : real
var sideName : string
var mainName : string
var drinkName : string
var drinkSizeName : string
var font1 : int := Font.New ("Arial:30")
var font2 : int := Font.New ("Arial:20")
%%%%%%%%%%%%%%%%%
%PROGRAM PROCESS
%%%%%%%%%%%%%%%%%
%Drawing Procedure
proc drawing
%Fries
Draw.ThickLine (138, 156, 76, 232, 17, black)
Draw.ThickLine (138, 156, 76, 232, 15, yellow)
Draw.ThickLine (112, 160, 112, 246, 17, black)
Draw.ThickLine (112, 160, 112, 246, 15, yellow)
Draw.ThickLine (122, 157, 87, 244, 17, black)
Draw.ThickLine (122, 157, 87, 244, 15, yellow)
Draw.ThickLine (107, 169, 100, 250, 17, black)
Draw.ThickLine (107, 169, 100, 250, 15, yellow)
Draw.ThickLine (120, 169, 130, 250, 17, black)
Draw.ThickLine (120, 169, 130, 250, 15, yellow)
Draw.ThickLine (138, 156, 143, 245, 17, black)
Draw.ThickLine (138, 156, 143, 245, 15, yellow)
Draw.ThickLine (164, 156, 162, 240, 17, black)
Draw.ThickLine (164, 156, 162, 240, 15, yellow)
Draw.ThickLine (153, 162, 173, 237, 17, black)
Draw.ThickLine (153, 162, 173, 237, 15, yellow)
Draw.ThickLine (169, 158, 202, 235, 17, black)
Draw.ThickLine (169, 158, 202, 235, 15, yellow)
%Fry Container
drawline (100, 100, 80, 200, red)
drawarc (140, 100, 40, 10, 0, 180, red)
drawline (180, 100, 200, 200, red)
drawline (200, 200, 184, 195, red)
drawline (80, 200, 96, 195, red)
drawarc (140, 195, 45, -32, 180, 360, red)
drawdot (186, 195, red)
drawdot (185, 195, red)
drawdot (181, 102, red)
drawdot (186, 194, red)
drawdot (99, 102, red)
drawdot (81, 199, red)
drawdot (186, 194, red)
drawdot (186, 195, red)
drawdot (185, 195, red)
drawfill (130, 140, red, red)
end drawing
%Side Meal procedure
proc sidemeal
locate (13, 1)
put "Please choose a side meal:"
put "1)Normal Fries $1.25"
put "2)Curly Fries $1.75"
put "3)Poutine $3.25" %Gives options side meals for user
put "4)Salad $1.50"
put "5)Nothing"
put " "
get sideMeal
put " "
if sideMeal = 1 then
sideMealCost := 1.25
sideName := "Normal Fries,"
put "You have selected a normal fries."
elsif sideMeal = 2 then
sideMealCost := 1.75
sideName := "Curly Fries,"
put "You have selected a curly fries."
elsif sideMeal = 3 then
sideMealCost := 3.25
sideName := "Poutine,"
put "You have selected a poutine." %Gives a variable an amount for future use
elsif sideMeal = 4 then
sideMealCost := 1.5
sideName := "Salad,"
put "You have selected a salad."
elsif sideMeal = 5 then
sideMealCost := 0
sideName := ""
put "You have selected none of the above side meals."
end if
if sideMeal > 5 then
put "You have chosen an invalid side meal. The program will close in 5 seconds."
delay (5000)
Window.Close (window) %If an option is selected over the given amount then the program will close in 5 seconds
end if
delay (1000)
cls
end sidemeal
%Main Meal procedure
proc mainmeal
Font.Draw ("Greasy Side Stop!", 100, maxy - 40, font1, 9)
locate (11, 1)
put "Please choose a main meal:"
put "1)Hotdog $1.25"
put "2)Cheese Burger $2.00"
put "3)Plain Burger $2.50" %Gives user options for meals
put "4)Mexican Wrap $2.00"
put "5)Vegetarian Wrap $1.80"
put "6)Nothing"
put " "
get mainMeal
put " "
if mainMeal = 1 then
mainMealCost := 1.25
mainName := "Hot Dog,"
put "You have selected a HotDog."
elsif mainMeal = 2 then
mainMealCost := 2
mainName := "Cheese Burger,"
put "You have selected a Cheese Burger."
elsif mainMeal = 3 then
mainMealCost := 2.5
mainName := "Plain Burger,"
put "You have selected a plain Burger." %Gives a variable an amount for future use
elsif mainMeal = 4 then
mainMealCost := 2
mainName := "Mexican Wrap,"
put "You have selected a Mexican Wrap."
elsif mainMeal = 5 then
mainName := "Vegetarian Wrap,"
mainMealCost := 1.80
put "You have selected a Vegetarian Wrap."
elsif mainMeal = 6 then
mainName := ""
mainMealCost := 0
put "You have selected none of the above main meals."
end if
if mainMeal > 6 then
put "You have chosen an invalid main meal. The program will close in 5 seconds."
delay (5000)
Window.Close (window) %If an option is selected over the given amount then the program will close in 5 seconds
end if
delay (1000)
cls
end mainmeal
%Drinks Procedures
proc drinks
Font.Draw ("Greasy Side Stop!", 100, maxy - 40, font1, 9)
locate (11, 1)
put "Please choose your drink. Each drink is the same price."
put "1)Coca Cola"
put "2)Sprite"
put "3)Ice Tea" %Drink Selection for user
put "4)Orange Crush"
put "5)Root Beer"
put "6)Nothing"
put " "
get drinkType
put " "
if drinkType = 1 then
drinkName := " Coco Cola"
put "You have selected Coco Cola."
elsif drinkType = 2 then
drinkName := " Sprite"
put "You have selected Sprite."
elsif drinkType = 3 then
drinkName := " Ice Tea"
put "You have selected Ice Tea."
elsif drinkType = 4 then %Gives a variable an amount for future use
drinkName := " Orange Crush"
put "You have selected Orange Crush."
elsif drinkType = 5 then
drinkName := " Root Bear"
put "You have selected Root Bear."
elsif drinkType = 6 then
drinkName := ""
drinkCost := 0
put "You have selected none of the above drinks."
end if
if drinkType > 6 then
put "You have chosen an invalid drink. The program will close in 5 seconds."
delay (5000) %If an option is selected over the given amount then the program will close in 5 seconds
Window.Close (window)
end if
if drinkType >= 1 and drinkType <= 5 then %Drink Size if drink was chosen
delay (1000)
cls
drawing
Font.Draw ("Greasy Side Stop!", 100, maxy - 40, font1, 9)
locate (10, 1)
put "What size drink do you want?"
put "1)Small- $1.00"
put "2)Medium-$1.85" %Drink size for user selection
put "3)Large-$2.50"
put "4)Super Jumbo-$3.75"
put " "
get drinkSize
put " "
if drinkType = 6 then
drinkSizeName := ""
elsif drinkSize = 1 then
drinkSizeName := "and a small"
drinkCost := 1
put "You have selected a small drink."
elsif drinkSize = 2 then
drinkSizeName := "and a medium"
drinkCost := 1.85
put "You have selected a medium drink."
elsif drinkSize = 3 then
drinkSizeName := "and a large"
drinkCost := 2.5
put "You have selected a large drink."
elsif drinkSize = 4 then
drinkSizeName := "and a super jumbo"
drinkCost := 3.75
put "You have selected a Super Jumbo drink."
end if
if drinkSize >= 5 then
put "You have chosen an invalid drink size. The program will close in 5 seconds."
delay (5000)
Window.Close (window)
end if
end if
delay (1000)
cls
end drinks
%Pricing Procedures
proc pricing
%Formula Procedures
var cost : real := sideMealCost + mainMealCost + drinkCost
var subtotal : real := cost - discount
var freeMeal : int := Rand.Int (1, 10)
var userInput : int
Font.Draw ("Greasy Side Stop!", 100, maxy - 40, font1, 9)
locate (10, 1)
if sideMeal = 5 and mainMeal = 6 and drinkType = 6 then
put "You have not ordered anything"
delay (2000)
cls
quit
end if
put "Your bill"
put "_________"
if cost < 4 then
put "Cost :$", cost
put " "
put "You have not spent more than $4.00 and your discount is now invalid."
delay (2000)
put "Your Discount:$0"
put "Subtotal :$", cost
put "Tax (13%) :$", cost * 0.13 :0:2 %Pricing for costs that are less than $4.00
put " "
put "Total :$", (cost * 0.13) + cost :0:2
put "You have ordered: ", sideName, mainName, drinkName, "."
elsif cost > 4 then
put "Cost :$", cost
put " "
put "Your Discount:$", discount
put "Subtotal :$", subtotal
put "Tax (13%) :$", (subtotal * 0.13) :0:2 %Pricing for costs that are over than $4.00
put " "
put "Total :$", (subtotal * 0.13) + subtotal :0:2
put " "
put " "
put "You have ordered: ", sideName, mainName, drinkName, "."
end if
put " "
put "ENJOY YOUR MEAL!"
put "But wait! DO YOU WANT A FREE MEAL? JUST TYPE IN A NUMBER FROM 1-10 AND SEE IF YOU GUESSED RIGHT"
get userInput %Free Meal fun activity
if userInput = freeMeal then
put "Correct. This meal is now free!"
else
put "Wrong. You do not get the free meal!"
put "The correct answer is ", freeMeal, "."
end if
end pricing
%%%%%%%%%%%%%%
%MAIN PROGRAM
%%%%%%%%%%%%%%
setscreen ("graphics:600;800")
colorback (10)
GUI.SetBackgroundColor (10)
Font.Draw ("Greasy Side Stop!", 100, maxy - 40, font1, 9)
locate (5, 1)
put "Welcome to Kartik's Restaurant"
put " "
put "Finger Lick'n Greasy snacks!"
put " "
put "YOUR SPECIAL DISCOUNT! SAVE UP TO $3.00, IF YOU SPEND MORE THAN $4.00!"
put "You can save $", discount, " from your meal's total cost." %Introduction[Gives user their personal discount. Includes fun slogan]
put "We use our leftover grease for bio-fuel! "
put " "
put " "
drawing
sidemeal
GUI.SetBackgroundColor (10)
drawing
mainmeal
GUI.SetBackgroundColor (10) %Runs the procedures that were created above
drawing
drinks
GUI.SetBackgroundColor (10)
drawing
pricing
delay (4000)
cls
setscreen ("graphics:600;400")
GUI.SetBackgroundColor (9)
loop
Font.Draw ("I hope you enjoyed your meal!", 115, maxy - 40, font2, 12)
Font.Draw ("Please come again!", 145, maxy - 140, font2, 14)
delay (750)
Font.Draw ("I hope you enjoyed your meal!", 115, maxy - 40, font2, 4)
Font.Draw ("Please come again!", 145, maxy - 140, font2, 24)
delay (750) %Ending slogan and program finish
Font.Draw ("I hope you enjoyed your meal!", 115, maxy - 40, font2, 8)
Font.Draw ("Please come again!", 145, maxy - 140, font2, 6)
delay (750)
Font.Draw ("I hope you enjoyed your meal!", 115, maxy - 40, font2, 24)
Font.Draw ("Please come again!", 145, maxy - 140, font2, 16)
end loop
loop
exit when GUI.ProcessEvent
end loop