![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Programming A discussion forum for programs and programming used in tech-related businesses. |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Oct 2009
Posts: 3
OS: windows vista
|
C RESTAURANT BILLING SYSTEM project: Helpe me pleas
Heloo, every body,,
Please help me, this my project in c programme which is: as follow: THE QUESTION: RESTAURANT BILLING SYSTEM Write a program in C to computerize the billing system of a restaurant. The customer bill is charged based on the following information: • Assume that the restaurant offers the following menu (the price of each item for each adult is shown to the right of the item): 1. Fish and Chips RM15.80 2. Spaghetti RM10.50 3. T-Bone Steak RM19.00 4. Chicken Chop RM14.00 5. Chicken Maryland RM12.00 6. Red Lobster RM22.00 7. Seafood Platter RM16.00 • The prices per person shown are inclusive of drinks. Children’s meals will cost 60% of adult meals. • A tax rate, currently 5%, is added to the total bill. • User is able to input the new or edit items in the restaurant menu along with their prices. • To attract more customers to this restaurant, the owner wants to give discount. This discount depends on the amount of the total bill: If the bill is less than RM10.00, the discount is 0.5%. If the bill is at least RM10.00 but less than RM20.00, the discount is 1.0%. If the bill is at least RM20.00 but less than RM30.00, the discount is 1.5%. If the bill is at least RM30.00 but less RM40.00, which is: Code:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
double price[7] = {15.80 , 10.50 , 19.00 , 14.00 , 12.00 , 22.00 , 16.00 };
double mealTaxPrices[7];
int adultNumber,childNumber;
void printMeals();
void orderMeals();
double orderForAdult();
double orderForChildren();
int main()
{
char response = 'y';
printMeals();
while(response == 'y'|| response == 'Y')
{
printf("please enter number of adults :");
scanf("%d",&adultNumber);
printf("please enter number of children:");
scanf("%d",&childNumber);
orderMeals();
printf("\nwould you like to continue(y/n):");
scanf("\n%c",&response);
}
printf("\n ******************** THANK YOU FOR COMING *************************\n");
printf("\20********************** PLEASE VISIT US NEXT TIME **************************\20 \n");
system("pause");
return 0;
}
void printMeals()
{
printf("\20******************* WELCOME TO HADRAMOUT RESTURANT **************************\20\n");
printf(" \t\t\t Below is the menue:\20\n");
printf(" \t\t\t MEALS\t\t\tPRICE:\n");
printf(" \t\t\t \22*******************************\22\n");
printf(" \t\t\t 1- Fish and Chips\tRM15.80\n");
printf(" \t\t\t 2- Spaghetti\t\tRM10.50\n");
printf(" \t\t\t 3- T-Bone Steak\tRM19.00\n");
printf(" \t\t\t 4- Chicken Chop\tRM14.00\n");
printf(" \t\t\t 5- Chicken Maryland\tRM12.00\n");
printf(" \t\t\t 6- Red Lobster\t\tRM22.00\n");
printf(" \t\t\t 7- Seafood Platter\tRM16.00\n");
printf("\n");
}
void orderMeals()
{
double totalPriceForAdult, totalPriceForChildren;
double allPayment,discount;
printf(" \t\t**** ORDER MENUE****\n");
totalPriceForAdult = orderForAdult();
totalPriceForChildren = orderForChildren();
allPayment = totalPriceForAdult + totalPriceForChildren ;
printf("\n \t\t \22**************************************\22 \n");
printf(" \t\t ****************** final BILL ************ \n");
printf(" \t\t\tadult/child\tcount\t\ttotal price\n");
printf(" \t\t\tadults\t\t%d\t\t%5.2f\n",adultNumber,totalPriceForAdult);
printf(" \t\t\tchildren\t%d\t\t%5.2f\n",childNumber,totalPriceForChildren);
printf(" \t\t\tTotal bill\t\t\t%5.2f\n",allPayment );
if(allPayment < 10)
discount=((allPayment * 0.5)/100);
else if(allPayment>= 10 && allPayment<20)
discount=((allPayment * 1)/100);
else if(allPayment>= 20 && allPayment<30)
discount=((allPayment * 1.5)/100);
else if(allPayment>= 30 && allPayment<40)
discount=((allPayment * 2.0)/100);
else
discount= ((allPayment * 5.0)/100);
printf(" \t\t\tTotal bill after discount\t%5.2f\n",allPayment-discount);
}
double orderForAdult()
{
int menuOption,i,amount;
char response = 'y';
double totalPerPerson = 0.0,totalAllPerson = 0.0;
double tax = 5.0;
if(adultNumber <=0)
printf("\n ");
else
printf("*\tadults:\n");
for(i=0;i<adultNumber;i++)
{
printf("adult %d please enter your orders\n",i+1);
while(response == 'y' || response == 'Y')
{
printf("please enter your option:");
scanf("%d",&menuOption);
if(menuOption<1 || menuOption>7)
{
printf("sorry we don`t have this order \nagain! ");
continue;
}
printf("please enter your amount of order:");
scanf("%d",&amount);
totalPerPerson = totalPerPerson + (amount * price[menuOption - 1] );
printf("\nWould you like to enter more orders(y/n):");
scanf("\n%c",&response);
}
printf("\n");
totalAllPerson += totalAllPerson + totalPerPerson;
totalPerPerson = 0.0;
response = 'y';
}
return totalAllPerson + ((totalAllPerson * tax) / 100);
}
double orderForChildren()
{
int menuOption,i,amount;
char response = 'y';
double totalPerChild = 0.0,totalAllChildren = 0.0;
double tax = 5.0,oneOrder;
if(childNumber <=0)
printf("\n");
else
printf("*\tChildren:\n");
for(i=0;i<childNumber;i++)
{
printf("child %d please enter your orders\n",i+1);
while(response == 'y' || response == 'Y')
{
printf("please enter your option:");
scanf("%d",&menuOption);
if(menuOption<1 || menuOption>7)
{
printf("sorry we don`t have this order \nagain! ");
continue;
}
printf("please enter your amount of order:");
scanf("%d",&amount);
oneOrder = (price[menuOption - 1] * 60)/100 ;//this one order for a child with discount %60 of one order of adult
totalPerChild = totalPerChild + (amount * oneOrder) ;
printf("Would you like to enter more orders(y/n):");
scanf("\n%c",&response);
}
totalAllChildren += totalAllChildren + totalPerChild;
response = 'y';
totalPerChild = 0.0;
printf("\n");
}
return totalAllChildren + ((totalAllChildren * tax) / 100);
}
the problem is all about how i can let the user to edit the entered data for the childes and adults , and how i can disply the prices for every one. " the most important is how i can lit the user to edit what her ordered. ![]() ![]() ![]() ![]() please i have to submet it the nexet week.
|
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
Registered User
Join Date: Sep 2009
Posts: 5
OS: winxp
|
Re: C RESTAURANT BILLING SYSTEM project: Helpe me pleas
The simplist way to do this is to first have all of the values correspond to an array. In order to do this have the a two-dimenionsal [n][x] array. n= #of food choices, and x is 2, child and adults. If they want to edit it ask them for which item of food. To do this display all of the choices with a corresponding number(ie. 1 = "food 1" and so on). Then when they edit it have it as food[m][0]=adults, food[m][0], where m corresponds to the food choice they gave. Have that on a loop until they say no, they dont want to edit anything anymore.
James Weber off site backup in Los Angeles |
|
|
|
|
|
#3 (permalink) |
|
Registered User
Join Date: Oct 2009
Posts: 3
OS: windows vista
|
Re: C RESTAURANT BILLING SYSTEM project: Helpe me pleas
whatever.. thx for ur idea, i did my project and i got the way of doing that and i submit it and it was awesome. it was close to what u r saying. >>>>>> thx >>>> Br__b.
|
|
|
|
![]() |
| Thread Tools | |
|
|