Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

assignment

kekanapkekanap Posts: 4Member
I am very new on pascal and it happends to be my first programming experience. I have an assignment and I dont know how I am going to complete it in 12 hours.

-create a programm that will display the menu
Midrand Graduate Institude
Canteen System Menu
2003
A. Produce a till slip
B. Totals report
Q. Quite
Please enter your choice (A,B or Q)

-Producing a till slip-> the following needs to take place in this procedure : The user should enter the method of payment i.e. 1 Cash,2 Credit, 3 Account and a receipt number should be assigned to every transaction.

if a customer is paying cash then he gets 10% discount and the only the date is recorded.

if a customer is using Credit then he gets 5% discount the Client name,id and date has to be recorded.

if a customer is paying by Account then he gets 2.5% discount and the client account number, ckient name,id and date need to be recorded.

The customer has an option to buy the following

Product number Description Cost Price
101 Coke 4.50
102 Fanta 4.50
103 Sprite 4.50
110 Hamburger 10.99

-allow to select product number
-allow user to enter number of products bought
-assign cost price to product selected according to product number and work out how much it will cost the client
-accumulate the total of all products bought and and 14%.

The till slip should lok like

Midrand Canteen
Date: 28/3/2003 Account Number:
Name: Id:

Total:
Discount:
vat: 14%
Total due:

-the programme should be able to accept money from a client and work out change(if any) and display to screen. After this the main menu should be displayed again. If a client pays with Credit or Account then change should be 0(zero).

-Totals report -> totals that are accumulated on sales should be displayed when user slects total reports from menu.

eg. Number of sales: 1
Total before Vat: 100.00
Discount: 10.00
Total Vat: 12.60
Total after Vat: 102.60


Your help would be greatly appreciated.


Comments

  • ManningManning Posts: 1,621Member
    : I am very new on pascal and it happends to be my first programming experience. I have an assignment and I dont know how I am going to complete it in 12 hours.

    Your teacher wasn't very nice to only give you 12 hours to do that. I think you should probably start by posting the code you have so far and asking specifically what you are having problems with.
  • Phat NatPhat Nat Posts: 757Member
    : : I am very new on pascal and it happends to be my first programming experience. I have an assignment and I dont know how I am going to complete it in 12 hours.
    :
    : Your teacher wasn't very nice to only give you 12 hours to do that. I think you should probably start by posting the code you have so far and asking specifically what you are having problems with.
    :

    Also, sounds failry difficult for a first assignment. I could see it Maybe without the saving of the data... file or otherwise.

    Anyways, the menus shouldn't be too hard.
    (1) clear the screen
    (2) write the selections to the screen
    (3) read the input from the user
    (4) call an appropriate procedure for the selection
    [code]
    If c = 'A' Then DoTillSlip;
    If c = 'B' Then DoTotalsReport;
    [/code]

    These should be contained within a loop (of your choice) and should exit when the user enters 'Q' (c = 'Q').

    Just make more menus like the one above in the procedures [b]DoTillSlip[/b] and [b]DoTotalsReport[/b] if needed (for cash/credit card/etc) selection.

    Phat Nat

  • kekanapkekanap Posts: 4Member
    [b][red]This message was edited by Moderator at 2003-4-30 5:22:52[/red][/b][hr]
    thanx for your input guys. This is how my code looks like so far. I would like my to be able to select code 101 which is a coke and code 102 which is a Fanta and both of them are 4.50. I would like to have a choice to choose again acoke if i want to and calculate the total amount. Please help.

    [code]
    program kyokushin;

    uses crt;

    var choice:string;
    choose:integer;
    total_amount:integer;
    total_cost_price:integer;

    const vat = 14/100;
    pay_credit = 5/100;
    pay_cash = 10/100;
    pay_account = (5/2)/100;

    var a,b,c,d,e,f,g:real;
    aa,bb,cc,dd,ee,ff,gg:real;


    procedure calculate_items;
    {var a,b,c,d,e,f,g:real;
    aa,bb,cc,dd,ee,ff,gg:real;}
    begin
    a:=101;
    b:=102;
    c:=103;
    d:=110;
    e:=111;
    f:=112;
    g:=113;

    { aa:=4.50;
    bb:=4.50;
    cc:=4.50;
    dd:=10.99;
    ee:=6.50;
    ff:=7.40;
    gg:=8.50; }

    writeln('This are the items which are available');

    writeln('Product number Description Cost Price');
    writeln('101 Coke R4.50');
    writeln('102 Fanta R4.50');
    writeln('103 Sprite R4.50');
    writeln('110 Hamburger R10.99');
    writeln('111 Chips R6.50');
    writeln('112 Fish R7.40');
    writeln('113 Pies R8.50');

    writeln('Thats all we have on the menu');

    writeln('Now, what would you like to have? Please select the Product number');

    readln;

    if a=101 then
    writeln('Coke = ' aa);
    end;


    if b=102 then
    writeln('Fanta = ' bb);
    end;

    if c=103 then
    writeln('Sprite = ' cc);
    end;

    if d=110 then
    writeln('Hamburger = ' dd);
    end;

    if e=111 then
    writeln('Chips = ' ee);
    end;

    if f=112 then
    writeln('Fish = ' ff);
    end;

    if g=113 then
    writeln('Pies = ' gg);
    end;
    [/code]

    Any help would be appreciated.



    [Red]*Edited for formatting[/Red]
  • Phat NatPhat Nat Posts: 757Member
    [b][red]This message was edited by Phat Nat at 2003-4-30 7:53:59[/red][/b][hr]
    Just put your whole program into a loop. Make a certain number to exit or if they hit 'Q' or something along those lines. I suggest a REPEAT...UNTIL loop, but you can use whatever you prefer.

    To actually read the data from the keyboard, you need to do this:
    [code]
    { This is the proper way }
    ReadLn(MyNumber);

    { This was what you did. It will read the number, but not store it anywhere: }
    ReadLn;
    [/code]

    Also, if you do want to have 'Q' to exit, try this:
    [code]
    VAR
    S : String;
    I : Integer;
    Error : Word;

    Repeat
    ReadLn(S);
    Val(S,I,Error); { Converts a string to a number, ERROR > 0 if not a number }
    If Error = 0 Then
    Begin
    If I = aa Then ;
    {...}
    End;
    Until (S = 'Q') or (S = 'q');
    [/code]

    This is a better way to read numbers in anyways, then if they enter letters, your program doesn't crash.

    Phat Nat



    : thanx for your input guys. This is how my code looks like so far. I would like my to be able to select code 101 which is a coke and code 102 which is a Fanta and both of them are 4.50. I would like to have a choice to choose again acoke if i want to and calculate the total amount. Please help.



Sign In or Register to comment.