I need Help !

This is a discussion on I need Help ! within the C Programming forums, part of the General Programming Boards category; Write a C program to help a HiFiís Restaurant automate its breakfast billing system. Your assignment should implement the following ...

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    5

    I need Help !

    Write a C program to help a HiFiís Restaurant automate its breakfast billing system. Your assignment should implement the following items:

    a.Show the customer the different breakfast items offered by the HiFiís Restaurant.
    b. Allow the customer to select more than one item from the menu.
    c. Calculate and print the bill to the customer.
    d. Produce a report to present your complete program and show more sample output.

    Assume that the HiFiís Restaurant offers the following breakfast menu:

    Plain Egg $2.50
    Bacon and Egg $3.45
    Muffin $2.20
    French Toast $2.95
    Fruit Basket $3.45
    Cereal $0.70
    Coffee $1.50
    Tea $1.80

    Your program must do the following task below:

    a. Define the data structs, menu item types with two components: menu item of type string and menu price of type double. Use an array to declare the data structs.
    b. Function get data to loads the data into the array menu list.
    c. Function show menu to show the different breakfast items offered by the restaurant and tell the user how to select the items.
    d. Function print receipt to calculates and prints the customer receipt. The billing amount should include a 5% tax.
    e. Format your output with two decimal places. The name of each item in the output must be left-justify. You may assume that the user selects only one item of a particular type.




    This is my assignment, anyone can me some ideas ?
    thank you.

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Welcome to the forum Caulson!

    Now get started on your program, ASAP. Because we HELP you in C, but you have to have some C for us to help you with.

    Post up your program when you get stumped, and tell us what's the problem. The more specific you are describing the problem(s), the more detailed your help can be.

    This is NOT a "we do your homework for you", forum. You have to take the lead, and get some skin into the coding.

    This shows the basic logic you need for your menu display:
    using for loop and functions to create a basic menu
    Last edited by Adak; 02-21-2011 at 07:36 PM.

  3. #3
    Third Eye Babkockdood's Avatar
    Join Date
    Apr 2010
    Posts
    352
    We're not here to do your homework for you. Put some effort into it, and if something goes wrong, read man pages, and Google around for help. Use the forums as a last resort.
    Quote Originally Posted by The Jargon File
    Microsoft Windows - A thirty-two bit extension and graphical shell to a sixteen-bit patch to an eight-bit operating system originally coded for a four-bit microprocessor which was written by a two-bit company that can't stand one bit of competition.

  4. #4
    Registered User
    Join Date
    Feb 2011
    Posts
    5
    Hi, Here is my code. Anyone can give me some idea how to do a calculation part


    thank you.



    #include<stdio.h>
    #include<conio.h>

    main()
    {

    char selection;
    printf("\n Menu");
    printf("\n 1 - plain egg");
    printf("\n 2 - bacon and egg");
    printf("\n 3 - Muffin");
    printf("\n 4 - French Toast");
    printf("\n 5 - Fruit basket");
    printf("\n 6 - Cereal");
    printf("\n 7 - coffee");
    printf("\n 8 - Tea");
    printf("\n Enter selection: ");
    scanf("%c", &selection);

    switch (selection)
    {
    case '1': printf("\plain egg\n");
    break;
    case '2': printf("\n bacon and egg\n");
    break;
    case '3': printf("\n Muffin\n");
    break;
    case '4': printf("\n French Toast\n");
    break;
    case '5': printf("\n Fruit Basket\n");
    break;
    case '6': printf("\n Cereal\n");
    break;
    case '7': printf("\n Coffee\n");
    break;
    case '8': printf("\n Tea\n");
    break;
    default : printf("\n Invalid selection\n");
    }
    getch();
    return 0;

    }

  5. #5
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Two things you need right away:

    1) Put your code between code tags. That keeps your code, looking like code, and easy to study.

    Click on the # icon in the editor, to get a pair of code tags. You can insert code tags manually by typing
    [code ] <<== I added an extra space so you could see the tag raw. Use no space in yours
    Code:
     before the actual code starts
    and [/code ] after it ends. <<== same as above. No spaces in your real code tags, of course.

    2) You didn't put in the do while loop, like my link to you showed. You will HAVE to have the menu show itself multiple times, so people can order multiple things from it.

    Check out that code I linked to, and add a do while loop. You can edit your post with the code, to include proper code tags.

    Do you know how to use structs yet?

    Add a getchar() after the scanf() for selection, to remove the newline left behind.
    Last edited by Adak; 02-23-2011 at 02:16 AM.

  6. #6
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,409
    Are you in the same class as the guy who posted this thread ??
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  7. #7
    Registered User
    Join Date
    Feb 2011
    Posts
    14
    Read the question carefully.The main function has to call showmenu() and take input as to what the user wants to eat and then pass this input to getdata().getdata() has to return the prices of the food items and those prices should be passed to printreceipt() where you print the bill.Try out accordingly.
    Hope this helps

  8. #8
    Registered User
    Join Date
    Feb 2011
    Posts
    5
    Hi, thank you for the reply. i dont know how to use struct program..anyone get the example ?

  9. #9
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,438
    There's a slew of tutorials here, including one on structs: Cprogramming.com - Programming Tutorials: C++ Made Easy and C Made Easy.

  10. #10
    Third Eye Babkockdood's Avatar
    Join Date
    Apr 2010
    Posts
    352
    Add an double variable to keep track of the total. When a user selects a menu item, add the correct amount to their total. Add a "proceed to checkout" menu item, and if the user selects that, show them their total and exit.

    Make sure you assign this variable to 0 before the program starts.

    To make floating-point numbers stop printing after a specific decimal place, call printf like this.

    Code:
    printf("%0.2f hello world %0.3f hello world\n", float1, float2);
    This will print float1 to the second decimal place, and float2 to the third decimal place. If you don't do this, your program will print five extra zeroes after the float.
    Quote Originally Posted by The Jargon File
    Microsoft Windows - A thirty-two bit extension and graphical shell to a sixteen-bit patch to an eight-bit operating system originally coded for a four-bit microprocessor which was written by a two-bit company that can't stand one bit of competition.

  11. #11
    Registered User
    Join Date
    Feb 2011
    Posts
    5
    Hi, this is the calculation part i done...anyone can tell me how to make a linking with two file ?
    thank you




    #include<stdio.h>
    #include <conio.h>
    #define s 10
    struct menu
    {
    char item[8];
    double price;
    }menu[s];

    int main()
    {
    int i, q;
    printf("Enter quantity?<===%d",s);
    scanf("%d", &q);
    fflush(stdin);
    for(i=0; i < q; i++)
    {
    printf("Enter name item- %d\n", i+1);
    gets(menu[i].item);
    fflush(stdin);
    printf("Price");
    scanf("%1.2f", &menu[i].price);
    fflush(stdin);
    }
    for (i=0; i < q; i++) {
    printf("rekod item: %s", menu[i].item);
    printf("Price: %1.2f\n", menu[i].price);
    getch();

    }
    }

  12. #12
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    I don't see code tags being used. If you don't read what we write, why should we read what you write? Right?

    Quzah.
    Hope is the first step on the road to disappointment.

  13. #13
    Registered User
    Join Date
    Feb 2011
    Posts
    3

    Please Help me

    Code:
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    printf("Hello Moderator! I  am a newbie programmer of c . please tell me how can i install a new compiler on my pc . \n i am using os named windows XP sp2. how can i install bordland on my pc without floppy drive. ");
    getch();
    }
    please compile my code and provide a solution.

  14. #14
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by meharsri View Post
    please compile my code and provide a solution.
    Way to hijack a thread...

  15. #15
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,648
    Best laugh of the day, meharsri, on so many levels. Epic troll???

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21