% this program was created by Kazim Haider
% this program was created on April 16th
% this program simulates a restaurant menu
% declare variables
var item : array 1 .. 20 of string
var amount : array 1 .. 20 of string
var Amount : array 1 .. 20 of int
var total : array 1 .. 20 of real
var finalTot : real
var price : array 1 .. 20 of real
var invoice : int
var gratuity : real
var hst : real
var reply : string
var Reply : int
var picID : int
var picID2 : int
var picID3 : int
var picID4 : int
var picID5 : int
var picID6 : int
var picID7 : int
var picID8 : int
var picID9 : int
var picID10 : int
var picID11 : int
var picID12 : int
var picID13 : int
var picID14 : int
var picID15 : int
var picID16 : int
var picID17 : int
var picID18 : int
var picID19 : int
var picID20 : int
var picID21 : int
var picID22 : int
var picID23 : int
var picID24 : int
var picID25 : int
var picID26 : int
var picID27 : int
var picID28 : int
var picID29 : int
var picID30 : int
var picID31 : int
var picID32 : int
var done : boolean := false
var winID : int
var x : int := 0
var response : string (1)
% storing the pictures in the variables
picID := Pic.FileNew ("Intro.jpg")
picID2 := Pic.FileNew ("RestaurantInterior.jpg")
picID3 := Pic.FileNew ("ShrimpFriedrice.jpg")
picID4 := Pic.FileNew ("SteakDinner.jpg")
picID5 := Pic.FileNew ("ChickenDish.jpg")
picID6 := Pic.FileNew ("fettucini.jpg")
picID7 := Pic.FileNew ("CaesarSalad.jpg")
picID8 := Pic.FileNew ("EggsBenedict.jpg")
picID9 := Pic.FileNew ("SteamedRice.jpg")
picID10 := Pic.FileNew ("Pasta.jpg")
picID11 := Pic.FileNew ("FiletMignon.jpg")
picID12 := Pic.FileNew ("Lasagna.jpg")
picID13 := Pic.FileNew ("Pizza.jpg")
picID14 := Pic.FileNew ("Omelette.jpg")
picID15 := Pic.FileNew ("Chili.jpg")
picID16 := Pic.FileNew ("Poutine.jpg")
picID17 := Pic.FileNew ("Lobster.jpg")
picID18 := Pic.FileNew ("RoastBeef.jpg")
picID19 := Pic.FileNew ("ShishKebab.jpg")
picID20 := Pic.FileNew ("MacNCheese.jpg")
picID21 := Pic.FileNew ("ColeSlaw.jpg")
picID22 := Pic.FileNew ("PotatoSalad.jpg")
picID23 := Pic.FileNew ("Soda.jpg")
picID24 := Pic.FileNew ("Coffee.jpg")
picID25 := Pic.FileNew ("Milkshake.jpg")
picID26 := Pic.FileNew ("IcedCoffee.jpg")
picID27 := Pic.FileNew ("Water.jpg")
picID28 := Pic.FileNew ("BottledWater.jpg")
picID29 := Pic.FileNew ("HotChocolate.jpg")
picID30 := Pic.FileNew ("Tea.jpg")
picID31 := Pic.FileNew ("IcedTea.jpg")
picID32 := Pic.FileNew ("BubbleTea.jpg")
% customizing the window size
winID := Window.Open ("graphics:800;720")
% process for music
process music
loop
% song that is going to be played
Music.PlayFile ("Music.mp3")
% exit statement to end the song when program finishes
exit when done
end loop
end music
% playing the music
fork music
% setting background colour
colorback (blue)
cls
% intro screen
Pic.DrawSpecial (picID, 50, 75, picCopy, picFadeIn, 2000)
delay (4500)
cls
% introduction
put "Welcome to Cerulean!"
Pic.DrawSpecial (picID2, 175, 200, picCopy, picFadeIn, 2000)
delay (4000)
cls
put "This will be your best dining experience ever!"
delay (1000)
put "You will see our menu and will be asked to choose what you would like to order."
delay (4000)
put "If your order is over $10, then a fee of 15% will be charged."
delay (3000)
put "We hope you enjoy your experience!"
delay (4500)
cls
% generating random invoice number
randint (invoice, 1, 500)
loop
x := x + 1
loop
% dummy proofing
loop
% displaying the menu of items
put "Food Items" : 20, "" : 10, "Price ($)" : 19, "Drinks" : 20, "Price ($)" : 9
put repeat ("-", 80)
put "1. Shrimp Fried Rice" : 20, 8.99 : 14, "" : 14, "21. Soda" : 20, 1.99 : 5
put "2. Steak Plate" : 20, 11.99 : 14, "" : 14, "22. Coffee" : 20, 1.39 : 5
put "3. Chicken Dish" : 20, 9.99 : 14, "" : 14, "23. Mango Milkshake" : 20, 2.59 : 5
put "4. Fettucini Alfredo" : 20, 8.99 : 14, "" : 14, "24. Iced Coffee" : 20, 1.79 : 5
put "5. Caesar Salad" : 20, 5.99 : 14, "" : 14, "25. Water" : 20, "Free!" : 5
put "6. Eggs Benedict" : 20, 5.99 : 14, "" : 14, "26. Bottled Water" : 20, 1.99 : 5
put "7. Steamed Rice" : 20, 4.99 : 14, "" : 14, "27. Hot Chocolate" : 20, 1.99 : 5
put "8. Pasta w/ Sauce" : 20, 7.99 : 14, "" : 14, "28. Tea" : 20, 1.99 : 5
put "9. Filet Mignon" : 20, 9.99 : 14, "" : 14, "29. Iced Tea" : 20, 1.39 : 5
put "10. Lasagna" : 20, 8.99 : 14, "" : 14, "30. Bubble Tea" : 20, 1.99 : 5
put "11. Meat Pizza" : 20, 9.99 : 14
put "12. Cheese Omelette" : 20, 6.99 : 14
put "13. Chili" : 20, 6.99 : 14
put "14. Poutine" : 20, 6.99 : 14
put "15. Lobster Tail" : 20, 9.99 : 14
put "16. Roast Beef" : 20, 9.99 : 14
put "17. Shish Kebab" : 20, 8.99 : 14
put "18. Mac 'n Cheese" : 20, 4.99 : 14
put "19.Cole Slaw" : 20, 3.99 : 14
put "20. Potato Salad" : 20, 3.99 : 14
put ""
put "Please enter the number beside your chosen dish/drink here ==>" ..
% getting user input
get reply
exit when strintok (reply)
put "Please enter an appropriate value!"
delay (1500)
cls
end loop
% converting string to an integer
Reply := strint (reply)
if Reply < 1 or Reply > 30 then
put "Please enter an appropriate value!"
delay (1500)
cls
elsif Reply >= 1 or Reply <= 30 then
exit
end if
end loop
delay (1000)
cls
case Reply of
label 1 :
Pic.DrawSpecial (picID3, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Shrimp Fried Rice"
price (x) := 8.99
label 2 :
Pic.DrawSpecial (picID4, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Steak Plate"
price (x) := 11.99
label 3 :
Pic.DrawSpecial (picID5, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Chicken Dish"
price (x) := 9.99
label 4 :
Pic.DrawSpecial (picID6, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Fettucini Alfredo"
price (x) := 8.99
label 5 :
Pic.DrawSpecial (picID7, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Caesar Salad"
price (x) := 5.99
label 6 :
Pic.DrawSpecial (picID8, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Eggs Benedict"
price (x) := 5.99
label 7 :
Pic.DrawSpecial (picID9, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Steamed Rice"
price (x) := 4.99
label 8 :
Pic.DrawSpecial (picID10, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Pasta w/ Sauce"
price (x) := 7.99
label 9 :
Pic.DrawSpecial (picID11, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Filet Mignon"
price (x) := 9.99
label 10 :
Pic.DrawSpecial (picID12, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Lasagna"
price (x) := 8.99
label 11 :
Pic.DrawSpecial (picID13, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Meat Pizza"
price (x) := 9.99
label 12 :
Pic.DrawSpecial (picID14, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Cheese Omelette"
price (x) := 6.99
label 13 :
Pic.DrawSpecial (picID15, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Chili"
price (x) := 6.99
label 14 :
Pic.DrawSpecial (picID16, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Poutine"
price (x) := 6.99
label 15 :
Pic.DrawSpecial (picID17, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Lobster Tail"
price (x) := 9.99
label 16 :
Pic.DrawSpecial (picID18, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Roast Beef"
price (x) := 9.99
label 17 :
Pic.DrawSpecial (picID19, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Shish Kebab"
price (x) := 8.99
label 18 :
Pic.DrawSpecial (picID20, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Mac 'n Cheese"
price (x) := 4.99
label 19 :
Pic.DrawSpecial (picID21, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Cole Slaw"
price (x) := 3.99
label 20 :
Pic.DrawSpecial (picID22, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Potato Salad"
price (x) := 3.99
label 21 :
Pic.DrawSpecial (picID23, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Soda"
price (x) := 1.99
label 22 :
Pic.DrawSpecial (picID24, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Coffee"
price (x) := 1.39
label 23 :
Pic.DrawSpecial (picID25, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Mango Milkshake"
price (x) := 2.59
label 24 :
Pic.DrawSpecial (picID26, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Iced Coffee"
price (x) := 1.79
label 25 :
Pic.DrawSpecial (picID27, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Water"
price (x) := 0.00
label 26 :
Pic.DrawSpecial (picID28, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Bottled Water"
price (x) := 1.99
label 27 :
Pic.DrawSpecial (picID29, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Hot Chocolate"
price (x) := 1.99
label 28 :
Pic.DrawSpecial (picID30, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Tea"
price (x) := 1.99
label 29 :
Pic.DrawSpecial (picID31, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Iced Tea"
price (x) := 1.39
label 30 :
Pic.DrawSpecial (picID32, 175, 200, picCopy, picFadeIn, 2000)
item (x) := "Bubble Tea"
price (x) := 1.99
label :
put "Please enter an appropriate value!"
delay (1500)
cls
end case
loop
% dummy proofing
loop
put "How many of that would you like?" ..
get amount (x)
exit when strintok (amount (x))
put "Please enter an appropriate value!"
delay (1500)
cls
end loop
% converting string to an integer
Amount (x) := strint (amount (x))
% making sure negative numbers cannot be entered
if Amount (x) < 0 then
put "Please enter an appropriate value!"
delay (1500)
cls
else
exit
end if
end loop
put "Would you like to get your bill? Press 'x' to get your bill or anything else to continue" ..
getch (response)
cls
% exit statement
exit when response = "X" or response = "x"
end loop
|