
-----------------------------------
Newspaper
Sun Apr 22, 2012 12:48 am

Turing Array Problem Help!
-----------------------------------
Hi. I have to make a program that simulates a restaurant for school and it has to print out a bill and i am having trouble getting the selected items to be displayed after the user exits the loop. When i try to display items, it only puts the last selected item and if i try using a for loop to display the items i don't know what range to use. If someone could help me out it would be greatly appreciated! 

[code]

% 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 