cafeteria info management system

Post on 13-Jan-2015

1.157 Views

Category:

Education

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

BY :-

CHENDIKA VAMSI KRISHNA

G.ESWARA MOORTI

GAURAV SUBHAM

GAURAV KAUSHIK

GAURAV RAJ KHAIWAL

GAURAV SHARMA

GAURAV KUMAR SHARMA

GAUTAM AHUJA

GOURAV CHOKROBARTY

GUNJAN TYAGI

HARSHA MEHRA

CAFETERIA INFO MANAGEMENT SYSTEM

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.

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.

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.

SOFTWARE USED:

Operating system : Microsoft XP/Windows 7 Platform : C Language( 32 bits)

Application Software : MS Office 2007/11

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..

float price[7] = {25.00,50.00,20.00,50.00,40.00,60.00,40.00 };float mealTaxPrices[7];int persons;

void printMeals();

void orderMeals();

Void order();

void salary();

int main()

{

char response = 'y', ch;

printMeals();

while(response == 'y')

{ 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();}

‘|| ‘ 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.

VOID PRINTMEALS(){ PRINTF("\******** WELCOME TO CSE RESTURANT *******\N"); PRINTF(" \T\T\T BELOW IS THE MENU\T\T\T"); PRINTF(" \T\T\T\T\T MEALS\T\T\TPRICE:\N"); PRINTF(" \T\T\T 1- VEG BURGER\T\TRS.25\N"); PRINTF(" \T\T\T 2-CHICK.BURGER\T\TRS.50\N"); PRINTF(" \T\T\T 3- VEG PATTIES\T\TRS.20\N"); PRINTF(" \T\T\T 4- CHICK.PATTIES\TRS.50\N"); PRINTF(" \T\T\T 5- SANDWICH\T\TRS.40\N"); PRINTF(" \T\T\T 6- PEPSI\T\TRS.60\N"); PRINTF(" \T\T\T 7- FANTA\T \TRS.40\N"); PRINTF("\N");}

When the function void printMeals() is called it will diplay the above menu list.

void orderMeals()

{

float totalPrice;

float Payment,discount;

printf(" \t\tORDER MENU\n");

totalPrice = order();

Payment = totalPrice ;

printf(" \t\t ** final BILL ** \n");

printf(" \t\t\tperson\t\t%d\t\t%5.2f\n",persons,totalPrice);

printf(" \t\t\tTotal bill\t\t\t%5.2f\n",Payment );

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(" \t\t\tTotal bill after discount\t%5.2f\n",discount);

}

In the nested if else, the discount will be given based on the given conditions.

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 orders\n",i+1);

while(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 +=TOTALPERPERSON; TOTALPERPERSON = 0; RESPONSE = 'Y'; } RETURN TOTALALLPERSON + ((TOTALALLPERSON * TAX) / 100); }

VOID SALARY(){ CHAR CH; FILE *PTR; PTR=FOPEN("SALARY.TXT","R"); IF(PTR==NULL)

OUTPUT

{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

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

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.

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.

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.

THANK YOU

top related