Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Last and final problem with program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Sam_sam




PostPosted: Thu Jan 15, 2009 6:57 pm   Post subject: Last and final problem with program

Something is wrong with my program. I wanted to used const for the price.( They are the variables that are capitalized, but the program seems to just skip that).
When you run my program... and you have finished everything until the checkout page, you will see that the buffalo won't tell the quantity of the price. I know that I am being a huge pain but HELP! THANKS SO MUCH DUDES... I appreciate it.. this is due tomorrow eh... Sad

Turing:

%---------------------% WELCOME PAGE AND VARIABLES%---------------------------%

%List of used Variables thourghout the program
var x, y, buttonnumber, buttonupdown : int
var fontPapyrus : int
var fontArial : int
var fontArial1 : int
var total : real := 0
var choice1 : string
var qofbs : int := 0
var qoflime : int := 0
var qofsweey : int := 0
var qofspicy : int := 0
var tofbs : real := 0
var tofsweey : real := 0
var toflime : real := 0
var tofspicy : real := 0
var cash : real:=0
var BUFFALOP : real := 10.99
var SWEETP : real := 11.99
var LIMEP : real := 8.99
var SPICYP : real := 8.00



% Background colour for all screens
setscreen ("graphics")
colorback (yellow)
cls
% Fonts used
fontPapyrus := Font.New ("Papyrus:30:italic")
fontArial := Font.New ("Arial:12:italic")
fontArial1 := Font.New ("Arial:12:bold")

% Introduction Page
Font.Draw ("Welcome to The Chicken Wing ", 32, 345, fontPapyrus, purple)
Font.Draw ("Factory", 216, 277, fontPapyrus, purple)
Font.Draw ("\"Once you come, you'll never go back!!\"", 272, 58, fontArial, purple)
Pic.ScreenLoad ("chicken.jpg", 0, 0, picCopy)
delay (2000)
cls

%--------------------% INFORMARTION PAGES %--------------------------------%
forward procedure overview

% This procedure is used for the buffalo chicken information page, and purchase at that specific page.
procedure buffalo
    cls
    Pic.ScreenLoad ("Chic.jpg", 21, 227, picCopy)
    Font.Draw ("Buffalo Style", 255, 362, fontArial1, purple)
    Font.Draw ("These are the best chicken wings you will ever find", 255, 338, fontArial, purple)
    Font.Draw ("Juicy and rich with texture. You can't resist these wings", 255, 321, fontArial, purple)
    Font.Draw ("All for the cheap and low price. You will not find these", 255, 304, fontArial, purple)
    Font.Draw ("anywhere else.", 255, 287, fontArial, purple)
    Font.Draw ("         Price: $10.99", 255, 253, fontArial, purple)
    locate (15, 6)
    drawfillbox (44, 202, 110, 221, purple)
    Font.Draw ("Buy", 44, 202, fontArial, yellow)

    drawfillbox (143, 201, 199, 222, purple)
    Font.Draw ("Back", 143, 201, fontArial, yellow)
    loop
        buttonwait ("down", x, y, buttonnumber, buttonupdown)
        if (x > 44 and x < 110 and y > 202 and y < 221) then
            locate (17, 1)
            put "Quantity Please"
            locate (18, 1)
            get qofbs
            locate (19, 1)
            tofbs := tofbs + qofbs * SPICYP
            qofbs := 0 + qofbs
            put "Your total is $", tofbs : 0 : 2
            locate (20, 1)
            put "Loading Menu..."
            delay (2000)
            cls
            overview
        elsif (x > 151 and x < 200 and y > 191 and y < 229) then
            cls
            overview
        end if
        exit when x > 44 and x < 110 and y > 202 and y < 221 or x > 151 and x < 200 and y > 191 and y < 229
    end loop
end buffalo

% This procedure is used for the sweet and sour chicken information page, and purchase at that specific page
procedure sweet
    cls
    Pic.ScreenLoad ("SweetnSourchicken.jpg", 21, 227, picCopy)
    Font.Draw ("Sweet n' Sour Chicken", 255, 362, fontArial1, purple)
    Font.Draw ("These chickens are the hit of the house. Sweet and sour", 245, 338, fontArial, purple)
    Font.Draw ("at the same time to satisfy both you cravings of chicken.", 245, 321, fontArial, purple)
    Font.Draw ("All for the cheap and low price. You will not find these", 245, 304, fontArial, purple)
    Font.Draw ("anywhere else.", 245, 287, fontArial, purple)
    Font.Draw ("         Price: $11.99", 255, 253, fontArial, purple)
    locate (15, 6)

    drawfillbox (44, 202, 110, 221, purple)
    Font.Draw ("Buy", 44, 202, fontArial, yellow)

    drawfillbox (143, 201, 199, 222, purple)
    Font.Draw ("Back", 143, 201, fontArial, yellow)
    loop
        buttonwait ("down", x, y, buttonnumber, buttonupdown)
        if (x > 44 and x < 110 and y > 202 and y < 221) then
            locate (17, 1)
            put "Quantity Please"
            locate (18, 1)
            get qofsweey
            locate (19, 1)
            tofsweey := tofsweey + qofsweey * SWEETP
            qofsweey := 0 + qofsweey
            put "Your total is $", tofsweey : 0 : 2
            locate (20, 1)
            put "Loading Menu..."
            delay (2000)
            cls
            overview
        elsif (x > 151 and x < 200 and y > 191 and y < 229) then
            cls
            overview
        end if
        exit when x > 44 and x < 110 and y > 202 and y < 221 or x > 151 and x < 200 and y > 191 and y < 229
    end loop

end sweet

% This procedure is used for the spicy chicken information page, and purchase at that specific page.
procedure spicy
    cls
    Pic.ScreenLoad ("SpicyChicken.jpg", 21, 227, picCopy)
    Font.Draw ("Spicy Chicken", 255, 362, fontArial1, purple)
    Font.Draw ("Grab a bottle of water because these chickens are hot!", 255, 338, fontArial, purple)
    Font.Draw ("You'll be chugging down water with these delicious wings.", 255, 321, fontArial, purple)
    Font.Draw ("All for the cheap and low price. You will not find these", 255, 304, fontArial, purple)
    Font.Draw ("anywhere else.", 255, 287, fontArial, purple)
    Font.Draw ("         Price: $8.00", 255, 253, fontArial, purple)

    drawfillbox (44, 202, 110, 221, purple)
    Font.Draw ("Buy", 44, 202, fontArial, yellow)


    drawfillbox (143, 201, 199, 222, purple)
    Font.Draw ("Back", 143, 201, fontArial, yellow)
    loop
        buttonwait ("down", x, y, buttonnumber, buttonupdown)
        if (x > 44 and x < 110 and y > 202 and y < 221) then
            locate (17, 1)
            put "Quantity Please"
            locate (18, 1)
            get qofspicy
            locate (19, 1)
            tofspicy:= tofspicy + qofspicy * SPICYP
            qofspicy := 0 + qofspicy
            put "Your total is $", tofspicy : 0 : 2
            locate (20, 1)
            put "Loading Menu..."
            delay (2000)
            cls
            overview
        elsif (x > 151 and x < 200 and y > 191 and y < 229) then
            cls
            overview
        end if
        exit when x > 44 and x < 110 and y > 202 and y < 221 or x > 151 and x < 200 and y > 191 and y < 229
    end loop
end spicy

% This procedure is used for the lime chicken information page, and purchase at that specific page.
procedure lime
    cls
    Pic.ScreenLoad ("Lime Chicken.jpg", 15, 227, picCopy)
    Font.Draw ("Lime Chicken", 275, 362, fontArial1, 1)
    Font.Draw ("SOUR! Watch out, because these wings will have you ", 270, 338, fontArial, 1)
    Font.Draw ("scwirming in your seat. Iressistibly delicious just  ", 270, 321, fontArial, 1)
    Font.Draw ("for you tastebuds. All for the cheap and low price.  ", 270, 304, fontArial, 1)
    Font.Draw ("You will not find these anywhere else. ", 270, 287, fontArial, 1)
    Font.Draw ("Price: $8.99", 275, 260, fontArial, 1)
    locate (15, 6)

    drawfillbox (44, 202, 110, 221, purple)
    Font.Draw ("Buy", 44, 202, fontArial, yellow)

    drawfillbox (143, 201, 199, 222, purple)
    Font.Draw ("Back", 143, 201, fontArial, yellow)
    loop
        buttonwait ("down", x, y, buttonnumber, buttonupdown)
        if (x > 44 and x < 110 and y > 202 and y < 221) then
            locate (17, 1)
            put "Quantity Please"
            locate (18, 1)
            get qoflime

            locate (19, 1)
            toflime := toflime + qoflime * LIMEP
            qoflime := 0 + qoflime
            put "Your total is $", toflime : 0 : 2
            locate (20, 1)
            put "Loading Menu..."
            delay (2000)
            cls
            overview
        elsif (x > 151 and x < 200 and y > 191 and y < 229) then
            cls
            overview
        end if
        exit when x > 44 and x < 110 and y > 202 and y < 221 or x > 151 and x < 200 and y > 191 and y < 229
    end loop
end lime

% This procedure is used for the goodbye page.
procedure goodbye
    cls
    Font.Draw ("Thank you for visiting. ", 130, 345, fontPapyrus, purple)
    Pic.ScreenLoad ("byebye.jpg", 130, 48, picCopy)
    drawfillbox (0, 0, maxx, 10, purple)
    drawfillbox (maxx, 0, maxx - 10, maxy, purple)
    drawfillbox (maxx, maxy, 0, maxy - 10, purple)
    drawfillbox (0, maxy, 10, 0, purple)

end goodbye

% This procedure is the check out page, the final purchasing at this page.
procedure reciept
    cls
    Font.Draw ("ChickenWing Reciept", 90, 360, fontPapyrus, purple)
    locate (5, 7)
    put "Item                    Quantity                   Price"
    locate (6, 7)
    put "Spicy......................", tofspicy div SPICYP, ".......................$", tofspicy : 0 : 2
    locate (7, 7)
    put "Buffalo....................", tofbs div BUFFALOP, ".......................$", tofbs : 0 : 2
    locate (8, 7)
    put "Sweet n' Sour..............", tofsweey div SWEETP, ".......................$", tofsweey : 0 : 2
    locate (9, 7)
    put "Lime.......................", toflime div LIMEP, ".......................$", toflime : 0 : 2
    locate (11, 7)
    total := tofbs + tofsweey + tofspicy + toflime
    put "Sub-Total..........................................$", total : 0 : 2
    locate (10, 7)
    put "--------------------------------------------------------"
    locate (12, 7)
    put "Total..............................................$", total * 1.13 : 0 : 2

    locate (15, 7)
    put "Would you like to pay in Cash or use a Card?"
    locate (16, 7)
    get choice1

    if (choice1 = "Cash" or choice1 = "cash") then
        locate (17, 7)
        put "Please Enter your cash amount"
        locate (18, 7)
        get cash
        locate (19, 7)
        total := tofbs + tofsweey + tofspicy + toflime
        if (cash > total) then
            put "Your change is $", cash - total
            drawfillbox (564, 3, 630, 21, purple)
            Font.Draw ("Continue", 564, 3, fontArial, yellow)
        elsif (cash < total) then
            drawfillbox (564, 3, 630, 21, purple)
            Font.Draw ("Continue", 564, 3, fontArial, yellow)
            loop
                put "You owe me $", total - cash, " try again or get out of my store"
                get cash
                exit when (cash >= total)
            end loop
        end if


        loop
            buttonwait ("down", x, y, buttonnumber, buttonupdown)
            if (x > 564 and x < 630 and y > 3 and y < 21) then
                goodbye
            end if
            exit when x > 564 and x < 630 and y > 3 and y < 21
        end loop

    elsif (choice1 = "Card" or choice1 = "card") then
        drawfillbox (564, 3, 630, 21, purple)
        Font.Draw ("Continue", 564, 3, fontArial, yellow)
        buttonwait ("down", x, y, buttonnumber, buttonupdown)
        loop
            if (x > 564 and x < 630 and y > 3 and y < 21) then
                goodbye
            end if
            exit when x > 564 and x < 630 and y > 3 and y < 21
        end loop
        goodbye
    end if

end reciept

% This procedure is the overview page. This procudure allows you to choose your item, and select the item you want.
% This then directs you to the other procedures.
body procedure overview
    drawbox (15, 181, 214, 349, 1)
    drawbox (361, 182, 611, 348, 1)
    drawbox (22, 22, 221, 167, 1)
    drawbox (358, 23, 556, 173, 1)
    drawfillbox (564, 3, 630, 21, purple)

    Pic.ScreenLoad ("Chic.jpg", 15, 182, picCopy)
    Pic.ScreenLoad ("Lime Chicken.jpg", 361, 182, picCopy)
    Pic.ScreenLoad ("SweetnSourchicken.jpg", 22, 22, picCopy)
    Pic.ScreenLoad ("SpicyChicken.jpg", 358, 22, picCopy)
    fontPapyrus := Font.New ("Papyrus:30:italic")
    Font.Draw ("Click On An Image To See More", 20, 360, fontPapyrus, purple)
    Font.Draw ("Checkout", 564, 3, fontArial, yellow)


    loop
        buttonwait ("down", x, y, buttonnumber, buttonupdown)
        if (x > 15 and x < 214 and y > 181 and y < 349) then
            buffalo
        elsif (x > 361 and x < 611 and y > 182 and y < 348) then
            lime
        elsif (x > 22 and x < 221 and y > 22 and y < 167) then

            sweet
        elsif (x > 358 and x < 556 and y > 1 and y < 173) then
            spicy
        elsif (x > 564 and x < 630 and y > 3 and y < 21) then
            reciept

        end if
        exit when x > 15 and x < 214 and y > 181 and y < 349 or x < 361 and x > 611 and y > 182 and y < 348 or x > 22 and x < 221 and y > 22 and y < 167 or x > 358 and x < 556 and y > 1 and y < 173
            or x > 564 and x < 630 and y > 3 and y < 21

    end loop
end overview

overview


%reciept
Sponsor
Sponsor
Sponsor
sponsor
Sam_sam




PostPosted: Thu Jan 15, 2009 7:39 pm   Post subject: Re: Last and final problem with program

NEVER MIND GUYS! Thx to those who were trying to figure it out! IT GOT IT FOR ONCE!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: