
-----------------------------------
coolest35
Tue Oct 14, 2003 8:38 pm

Very Hard Programming Code .. ( atleast 2 me :P) need help
-----------------------------------
hi, i have an assignment it says " Create a program for a restaurant owner to keep track of customer bills as wells as daily sales. For each customer, the waiters/ waitresses have entered all items for the customers, the program should calculate the subtotal, PST (8%), GST (7%), total, and sugessested tip (15% of the subtotal). There is no PST charged for any subtotals less than $4. A 5% discount is offered for any subtotal more than $50 and a 10% discount for any subtotal more than $100. Your do not need to display discounts of zero. The program should continue for each customer. At the end of the day the program should provide the user with the daily totals for sales, taxes, discounts, and profits for the day." talk about a huge assignment this is what i have so far : 

------------------------------------------------------------------------------------

% -----------------------------
%
% ------------------------------


var movesales, continue, moresales : string
var quantity1, quantity2, quantity3, discount5 : int
var price1, price2, price3, subtotal, totaltotal, totalquantity1, totalquantity2, totalquantity3,quantity4,quantity5,quantity6 : real
var price4, price5, price6, totalquantity4,totalquantity5,totalquantity6,subtotal1,totaltotal2, pst1, pst2, tip2, grandtotal :real
var subtotal2 :real
loop

    const pst:= .08
    const gst:= .07
    const tip:= 0.15
        subtotal := 0
    discount5 := 0

    put "                           Restaurant Program"
    put "                          ---------------------"
    put ""
    put "               Enter The Quantity For Item ( 0 To Quit ): " ..
    get quantity1
    put ""
    if quantity1 > 0 then
        put "                   Enter The Price For The Item: " ..
        get price1
    end if
    totalquantity1 := price1 * quantity1
    put ""
    put "               Enter The Quantity For Item ( 0 To Quit ): " ..
    get quantity2
    put ""
    if quantity2 > 0 then
        put "                   Enter The Price For The Item: " ..
        get price2
    end if
    totalquantity2 := price2 * quantity2
    put ""
    put "               Enter The Quantity For Item ( 0 To Quit ): " ..
    get quantity3
    put ""
    if quantity3 > 0 then
        put "                   Enter The Price For The Item: " ..
        get price3

        totalquantity3 := price3 * quantity3
    end if
    cls

    subtotal := totalquantity1 + totalquantity2 + totalquantity3
    totaltotal := pst + gst + subtotal

    put ""
    put ""
    put "                       Sub-Total:   $", subtotal :0:2
    put "                       5% Discount: "
    put "                       PST:       ", "  $", pst * subtotal : 0 : 2
    put "                       GST:       ", "  $", gst * subtotal : 0 : 2
    put "                       ------------------"
    put ""
    put "                       Total:      ", " $", totaltotal
    put "                       Tip:         ", "$", totaltotal * tip :0:2
    put                         ""
    put "                       Press Any key To Continue" ..
    get continue
    cls
    put                             " Are There More Sales?  " ..
    get moresales
    exit when moresales = "n" or moresales = "NO" or moresales = "N" or moresales = "no"
end loop
cls
const tip1 := 0.15
    const gst1:= .07
   
        subtotal := 0
    discount5 := 0


        totalquantity6 := price6 * quantity6
    end if
    cls

    subtotal1 := totalquantity4 + totalquantity5 + totalquantity6
    totaltotal2 := pst1 + gst1 + subtotal2
loop
    put ""
    put ""
    put "                       Sub-Total:   $", subtotal2 :0:2
    put "                       5% Discount: "
    put "                       PST:       ", "  $", pst1 * subtotal2 : 0 : 2
    put "                       GST:       ", "  $", gst1 * subtotal2 : 0 : 2
    put "                       ------------------"
    put ""
    put "                       Total:      ", " $", totaltotal2
    put "                       Tip:         ", "$", totaltotal2 * tip2 :0:2
    put                         ""
    put "                       Press Any key To Continue" ..
    get continue
    cls
    put                             " Are There More Sales?  " ..
    get moresales
    exit when moresales = "n" or moresales = "NO" or moresales = "N" or moresales = "no"
    end loop
    
    put "                        Grand Totals For The Day"
    put "                       ---------------------------"
    put ""

-------------------------------------------------------------------------------------


I am so confused :cry:  :(  that I don't know what to do.. can someone please just correct the code :oops: .. i thank you in advance :wink:  ...

-----------------------------------
Mazer
Tue Oct 14, 2003 8:49 pm

Re: Very Hard Programming Code .. ( atleast 2 me :P) need he
-----------------------------------
can someone please just correct the code :oops: .. i thank you in advance :wink:  ...

oh, well since you thanked me in advance, hear's all of the code for you:


/*
   yoink!
*/


and that should set you off in the right direction for making an Evasive Maneuvers clone. wait, what was your question again?

-----------------------------------
coolest35
Tue Oct 14, 2003 9:01 pm

wrong..
-----------------------------------
uh.. the guy who replyed.. that was totally different .. than what ia asked about :(

-----------------------------------
Tony
Tue Oct 14, 2003 9:07 pm


-----------------------------------
yeah mazer... dont be an ass... but I will keep your Evasive Maneuvers code anyways... maybe you can post the rest of the code as well  :lol:

coolest35 - you're on the right track. Exsept that your program is way too hardcoded. Need to use arrays (if you learned them yet) and allow user more control over the input/output.

Comming to the forum, you've got to realize that noone will do your whole assignments for you, but if you have a specific question you would like to discuss, you're more then welcome to.

For your program, I might sujest trying to go backwards...

such as:

start with

put total


then work backwards from there... How do you get total? Subtotal + tax - discount.

How do you find those things? Continue from there. This way the assignment turns into more of a problem solving then guessing what to do next.

-----------------------------------
Mazer
Tue Oct 14, 2003 9:17 pm


-----------------------------------
i'm sorry, i just couldn't resist. please accept these bits as an apology

-----------------------------------
coolest35
Tue Oct 14, 2003 9:53 pm

still don't understand!!
-----------------------------------
I still don't understand this.. so . plz.. i have done about 50% of the assignment.. i still don't get it!! please .. can someone just finish the rest... please.. thank you very much to ther person that reply's to this poor guy's desperate plee's
 :(

-----------------------------------
Tony
Tue Oct 14, 2003 10:37 pm


-----------------------------------
well what are you having problems with? You've got it up to the display of total, whats next?

If you need daily total, you just keep on adding all the subtotals, taxes and discounts untill the "day" is over and display their values.

-----------------------------------
Andy
Wed Oct 15, 2003 10:46 am


-----------------------------------
wat? evasive manuver code where? *looks around*

-----------------------------------
Catalyst
Wed Oct 15, 2003 4:56 pm


-----------------------------------
my god that is ugly code

-----------------------------------
Mazer
Wed Oct 15, 2003 5:56 pm


-----------------------------------
:D 

why do you think i didn't post it for so long?
hey, it did it's job, and it even ran pretty well on the schools computers. but no, i won't deny that it really is ugly.

-----------------------------------
Tony
Wed Oct 15, 2003 6:05 pm


-----------------------------------
oh, boo hoo...

mazer hid his code in shame  :lol:

code does not suppost to look preaty, it's suppost to work. If code would be marked on how good it looks, we'll all be practicing ASCII art right now  :lol:

-----------------------------------
Prince
Wed Oct 15, 2003 6:10 pm


-----------------------------------
ASCII art!! woot woot :D 

                  /Â´Â¯/) 
                ,/Â¯  / 
               /    / 
         /Â´Â¯/'   '/Â´Â¯Â¯Â·Â¸ 
      /'/    /    /    /Â¨Â¨/Â¯\ 
     ('(    Â´    Â´     Â¯&;/'   ') 
      \                 '     / 
       '\'   \           _.Â·Â´ 
         \              ( 
           \             \

well now that doesnt look rite :?

-----------------------------------
Catalyst
Wed Oct 15, 2003 6:14 pm


-----------------------------------
still the code should be tidied up it is a real mess, probably very difficult to expand and repair

-----------------------------------
Mazer
Wed Oct 15, 2003 6:17 pm


-----------------------------------
oh, boo hoo...

mazer hid his code in shame  :lol:

code does not suppost to look preaty, it's suppost to work. If code would be marked on how good it looks, we'll all be practicing ASCII art right now  :lol:

good thinking!

-----------------------------------
coolest35
Wed Oct 15, 2003 10:37 pm

plz.. paypal
-----------------------------------
:)  8)  :lol: hi, i got a deal for someone.. i will pay them through paypal if they finish my assignment.. ( i will pay $10 US) ( will get paid after I  :shock: verify code)

-----------------------------------
Dan
Wed Oct 15, 2003 11:07 pm


-----------------------------------
i think you whould get a beter responce if you asked a spicfe quest rather then posting a lager asment question and a langer progame that is wrong.

also trying to trick poleop in to doing your wrok for is agseted the sites rules.

NOTE: i say trick b/c he is probly not old enogth to have a CC and the very code part 1st is a dead give away.

Congraualtions
You just got a place in the hall of shame

And thats not all you also got this topic to be locked!!

pleas try agean in a new post  :evil:
