2. CAFETERIA INFO MANAGEMENT SYSTEM
It is database to maintain the records of all items
such as the no. of items, its price, its quantity and
other details related to those items. In CIMS we
also maintain the record of employees and other
detail related to them.
3. USE OF CIMS
It helps us to maintain the record of everything
present in cafeteria, and also to maintain
records easily without being messed up and
thus reduce the time consumption.
4. LIST OF VARIABLES
In cafeteria info management system, we make use of the following variables:
1. TYPE OF THE MEAL (sandwiches/patties/beverages): int type
2. NAME OF THE MEAL: character type
3. QUANTITY OF THE MEAL: int type
4. COST OF THE MEAL: int type
5. TAX ON THE MEAL: int type
6. CATEGORY OF THE EMPLOYEES (manager/subordinates/guard):
character type
7. NUMBER OF PEOPLE IN EACH CATEGORY: int type
8. SALARY OF THE EMPLOYEES: int type.
5. SOFTWARE USED:
Operating system : Microsoft XP/Windows 7
Platform : C Language( 32 bits)
Application Software : MS Office 2007/11
6. CODING
#include<stdio.h>
#include<conio.h>
#include<string.h>
'#' is a symbol that says "next instruction is for pre-processor, not compiler".
Stdio.h is C program header file which contain printf and scanf.. It is standard
header file.
conio.h is Turbo C++ header file from Borland.. Its a non standard header
file..used for clrscr(), getch() functions..
8. {
PRINTF("PLEASE ENTER NUMBER OF PERSONS :");
SCANF("%D",&PERSONS);
ORDERMEALS();
PRINTF("NWOULD YOU LIKE TO CONTINUE(Y/N):");
SCANF("N%C",&RESPONSE);
}
PRINTF("N ******************** THANK YOU FOR COMING *************************N");
PRINTF("WANT TO SEE SALARIES???");
SCANF("%C", &CH);
IF(CH=='Y'||CH=='Y')
SALARY();
RETURN 0;
GETCH();
}
9. ‘|| ‘ represent OR operator ,will be executed even if any one of the condition will
be true
void printMeals();
void orderMeals();
the above both represents function definition.
while(response == 'y')
WHILE STATEMENT
is used to execute the set of statement repeatedly till the condition is specified
remains true.
12. When the function void printMeals() is called it will diplay the above menu list.
void orderMeals()
{
float totalPrice;
float Payment,discount;
printf(" ttORDER MENUn");
totalPrice = order();
Payment = totalPrice ;
printf(" tt ** final BILL ** n");
printf(" tttpersontt%dtt%5.2fn",persons,totalPrice);
printf(" tttTotal billttt%5.2fn",Payment );
13.
14. if(Payment < 10)
discount=((Payment * 0.5)/100);
else if(Payment>= 10 && Payment<20)
discount=((Payment * 1)/100);
else if(Payment>= 20 && Payment<30)
discount=((Payment * 1.5)/100);
else if(Payment>= 30 && Payment<40)
discount=((Payment * 2.0)/100);
else
discount= ((Payment * 5.0)/100);
printf(" tttTotal bill after discountt%5.2fn",discount);
}
In the nested if else, the discount will be given based on the given conditions.
15. int order()
{
int menuOption,i,amount;
char response = 'y';
int totalPerPerson = 0,totalAllPerson = 0;
int tax = 5;
if(persons <=0)
printf("n ");
else
for(i=0;i<persons;i++)
{
printf("person %d please enter your ordersn",i+1);
while(response == 'y')
16. {
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);
19. {
PRINTF("SORRY !!!! THE SPECIFIED FILE WAS NOT FOUND IN SYSTEM ");
}
WHILE(!FEOF(PTR))
{
CH=FGETC(PTR);
PRINTF("%C", CH);
}
FCLOSE(PTR);
}
FILE *PTR; REPRESENTS FILE IS USED WITH THE FILE POINTER NAME PTR.
PTR=FOPEN("SALARY.TXT","R");
IT WILL OPEN A FILE IN THE NAME OF SALARY IN READ MODE
20. PROBLEMS WHILE WRITING THE CODE
• totalPerPerson = totalPerPerson +(amount *
price[menuOption - 1] );
• -1 , only when -1 is given it will take array[0], other wise
for item 1 it will take as[1].
• Float array prices are declared inside main(). So it is not
able access by other functions outside the main
21. EXPLANATION OF CODE
It is a c program in which we have taken the prices
as well as the taxes on item in float and no. of
person in integer type.
In the first part of the code we are creating the
program i.e what we want to be in receipt and how
would be proceed.
22. In the second we created the program in such a way that it
shows it will show us the menu card.
In the next half we made the so as to tell the prices after
adding taxes and various discounts.
Further we made the program to check and the task as
per the requirement and then give the result i.e the price.
23. And in the last part we made the program to show
the salary of various employees.
And for making this code we have various
datatypes i.e. the
pointers, functions, strings, integer type, float and
many more.