Download as pdf or txt
Download as pdf or txt
You are on page 1of 30

p

PIMPRI CHINCHWAD EDUCATION


TRUST’S
PIMPRI CHINCHWAD COLLEGE OF ENGINEERING

DEPARTMENT OF INFORMATION TECHNOLOGY


ENGINEERING SECOND YEAR B. TECH 2021
IE-2
 Project Guide: Ms. Anuja Jadhav

• Submitted by:
Sr. No. Roll No Name
1 SYITA122 Vedang Dadape
2 SYITA123 Sarvesh Dakare
3 SYITA131 Vedant Dhote
4 SYITA121 Tejas Chaugule
FDS MINI PROJECT 

TOPIC : FOOD ORDER MANAGEMENT SYSTEM 

AIM:​ To develop an application for Food Ordering Management System

Description:-

The Application consists of two interfaces, one being the customer interface and
admin panel as the other.

Features provided for the customers :

Displays the food item list along with their price, quantity and the stock available.
The customer needs to enter the food serial number and the quantity desired thus
displaying their total cart price.
If they wish to order more, they could go back and choose again. Two way payment
options are made available i.e Cash and Credit. This will take their card number and
pin which will not be saved by us.

​Features provided for the admin panel :

Check the total cash made today and view the details for the card payments.
Add a food item or delete it from the menu. To ensure that the item is added
accordingly, we have an option for the instant food list. Item counter displays the
number of food items available.
Backing up the data and Instant Order Preview displays the food item along with the
quantity remaining.

Data Structures Used:

1) Singly Linked List

Display Features Used:

1) C++ Graphics
DESIGN OF THE APPLICATION

FROM => BEGIN


LEARNING EXPERIENCE

Using data structures, the organization of data has been done using a singly
linked list. The singly linked list consists of a sequence of nodes which has a
structure with the food name, price and quantity.
The data being organized in a linked list is the structure that contains the food
details.
Have used the functions like insert front, insert end, insert at a particular node,
delete a particular node, update the food item list and check out the cart items.
Using two interfaces i.e customer and the admin panel, have learnt to develop
an application that supports multi interfaces.
Have developed an application to implement this ADT.
Have learnt to use the C++ Graphics functions.
Code

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#include <windows.h>
#include <time.h>

/// Logic Functions

/// Update & Insert Function


void insertfirst(int data, char foodname[25], int quantity, float price);
void insertmid(int pos, int data, char foodname[25], int quantity, float
price);
void insertend(int data, char foodname[25], int quantity, float price);
void updatefood(int udata, int uquantity);

/// Display Function


void foodlist();
void order_view(int order, int quantity, int or_no);
void main_menu();

/// Delete & Count Function


void deletefood(int serial);
int countitem();

/// extra design Function

void cls();
void echo(char print[]);
void br(int line);
void pre(int tab);
void span(int space);
void ccolor(int clr);
void pwellcome();
void loadingbar();
void middle1(void);
void middtab1(void);
void backuploader(void);

/// START Structure Here

struct Node
{

char foodname[50];
int quantity;
float price;
int data;
struct Node *next;
};

typedef struct Node node;

node *head, *list;

int main()
{

system(">>>>>>>>>>> FOOD ORDERING MANAGEMENT SYSTEM <<<<<<<<<<<<");


system("mode con: cols=80 lines=30");

loadingbar();
cls();
pwellcome();
Sleep(300);
cls();

int c = 0;
int any;
int cardno[100];
float cardmoney[100];
float totalmoney = 0;
int total_order[100];
int order_quantity[100];
int order = 0;
int uquantity;
int citem;

head = NULL;
insertfirst(5, "Burger ", 23, 175.00);
insertend(6, "Pizza ", 13, 250.00);
insertend(1, "Hot Cake ", 8, 475.00);
insertend(2, "Coffee ", 46, 325.00);
insertend(3, "Ice cream", 46, 230.00);
insertend(4, "Sandwich ", 34, 320.00);
insertend(7, "Grill ", 7, 100);
insertend(8, "Pancakes ", 121, 350.00);
insertend(9, "Cold Drinks", 73, 120.00);

mainmenu:
br(1);

main_menu();

int main_menu_choice;

br(1);
pre(4);
fflush(stdin);
scanf("%d", &main_menu_choice);
if ((main_menu_choice >= 1 && main_menu_choice <= 3))
{

if (main_menu_choice == 1)
{

foodlist:

cls();
printf("=> 0. Main Menu ");
foodlist();
}

else if (main_menu_choice == 2)
{

int admin_panel_choice;
adminpanelchoice:

cls();
middle1();
pre(4);
printf("1. Main Menu\n\n\t");
Sleep(300);
printf("Please Enter Password or ( 1 to Back in Main Menu ) : ");

fflush(stdin);
// scanf("%d",&pin);
int p = 0;
char password[20];
do
{
password[p] = getch();
if (password[p] != '\r')
{
printf("*");
}
p++;
} while (password[p - 1] != '\r');
password[p - 1] = '\0';

if (strcmp(password, "eunoia") == 0)
{

node *temp;

temp = list;

adminchoice:

cls();
br(5);
pre(4);
echo("You are on Admin Panel\n\n");
pre(4);
printf(" 1. Total Cash Today \n\n");
Sleep(250);
pre(4);
printf(" 2. View Card Pay \n\n");
Sleep(250);
pre(4);
printf(" 3. Add Food \n\n");
Sleep(250);
pre(4);
printf(" 4. Delete Food \n\n");
Sleep(250);
pre(4);
printf(" 5. Instant Food List \n\n");
Sleep(250);
pre(4);
printf(" 6. Item Counter \n\n");
Sleep(250);
pre(4);
printf(" 7. Backup System\n\n");
Sleep(250);
pre(4);
printf(" 8. Instant Order Preview\n\n");
Sleep(250);
pre(4);
printf(" 0. Main Menu ");
Sleep(250);

int adminchoice;

fflush(stdin);
scanf("%d", &adminchoice);

if (adminchoice == 1)
{

cls();
middle1();
pre(4);
printf("Todays Total Cash : %0.2f \n", totalmoney);

Sleep(2000);

goto adminchoice;
}
else if (adminchoice == 2)
{

if (c != 0)
{

cls();
br(3);
pre(4);

printf(" ____________________________\n");
pre(4);
printf("| Card NO. | Money $ |\n");
pre(4);
printf("------------------------------\n");
pre(4);

for (int z = 1; z <= c; z++)


{

printf("| %d | %0.2f |\n", cardno[z],


cardmoney[z]);
pre(4);
printf("------------------------------\n");
pre(4);
Sleep(150);
}
Sleep(1500);
}

if (c == 0)
{

cls();
middle1();
pre(4);
printf("No Card History\n");
}
Sleep(1500);
goto adminchoice;
}

else if (adminchoice == 3)
{

foodadd:
cls();

char ffoodname[25];
int fquantity;
int fdata;
float fprice;
int fposi;

br(3);
pre(4);
printf(" Enter Food Name : ");

fflush(stdin);
scanf("%[^\n]s", ffoodname);
fquantity:
fflush(stdin);

br(2);
pre(4);
printf(" Enter Food Quantity : ");

scanf("%d", &fquantity);
fflush(stdin);

foodserial:
br(2);
pre(4);
printf(" Enter Food Serial : ");
scanf("%d", &fdata);
node *exist;
exist = list;
while (exist->data != fdata)
{
if (exist->next == NULL)
{
break;
}
exist = exist->next;
}
if (exist->data == fdata)
{
cls();
br(5);
pre(3);
printf(" Food Serial Already Exist, Please Re-
Enter ");
Sleep(2000);
goto foodserial;
}

fprice:
fflush(stdin);

br(2);
pre(4);
printf(" Enter Food Price : ");
fflush(stdin);

scanf("%f", &fprice);

br(2);
pre(4);
printf("Submiting your data");
for (int cs = 0; cs < 4; cs++)
{
printf(" .");
Sleep(500);
}

insertend(fdata, ffoodname, fquantity, fprice);

br(2);
pre(4);
printf("Adding Food Successfull....\n");

Sleep(2000);

goto adminchoice;
}
else if (adminchoice == 4)
{

cls();
middle1();
pre(2);
printf("Enter Serial No of the Food To Delete : ");
int fdelete;
fdelete:

fflush(stdin);
scanf("%d", &fdelete);
node *temp;
temp = list;
while (temp->data != fdelete)
{
temp = temp->next;
}
if (temp->data == fdelete)
{
deletefood(fdelete);
}
else
{
br(2);
pre(2);
printf("Please Enter Correct Number : ");
Sleep(500);
goto fdelete;
}

goto adminchoice;
}

else if (adminchoice == 5)
{

cls();
foodlist();
Sleep(1000);

br(2);
pre(4);
printf("1. <-- back \n\n");
pre(5);

fflush(stdin);
scanf("%d", &any);

goto adminchoice;
}

else if (adminchoice == 6)
{

citem = countitem();
cls();
for (int cs = 1; cs <= citem; cs++)
{
middle1();
pre(4);
printf("Item Counting ");
printf(" %d ", cs);
Sleep(150);
cls();
}
cls();
middle1();
pre(4);
printf("Total Food Item is --> %d \n", citem);
Sleep(2000);
goto adminchoice;
}

/// Backup System


else if (adminchoice == 7)
{

char date[35] = __DATE__;

strcat(date, ".txt");
FILE *fptr;
fptr = fopen(date, "w");
backuploader();
if (fptr == NULL)
{
br(3);
pre(3);
printf("Error!");
Sleep(500);
goto adminchoice;
}
fprintf(fptr, "Total Cash Today : %0.2f\n\n\n",
totalmoney);
fprintf(fptr, "Card No ------- Money \n\n");
for (int l = 1; l <= c; l++)
{
fprintf(fptr, "%d ------- %0.2f \n", cardno[l],
cardmoney[l]);
}
br(2);
pre(4);
printf("Backup Successfull...");
Sleep(1500);

fclose(fptr);
goto adminchoice;
}
else if (adminchoice == 8)
{

cls();
br(2);
pre(2);
ccolor(26);
printf("\n\t\t");
ccolor(240);
printf("___________________________________________________
___ ");
ccolor(26);
printf("\n\t\t");
ccolor(240);
printf("| Order No. | Name | Quantity | In Stock
|");
ccolor(26);
printf("\n\t\t");
ccolor(240);
printf("---------------------------------------------------
---");
ccolor(26);
for (int o = 1; o <= order; o++)
{
order_view(total_order[o], order_quantity[o], o);
}

br(2);
pre(4);
printf("1. <-- back \n\n");
pre(5);
fflush(stdin);
scanf("%d", &any);

goto adminchoice;
}
else if (adminchoice == 0)
{

goto mainmenu;
}

else
{
br(2);
pre(4);
printf("Please Select From List : ");
Sleep(500);
goto adminchoice;
}
}

else if (admin_panel_choice == 1)
{
goto mainmenu;
}
else
{
br(2);
pre(4);
printf("Please Enter Correct Choice");
goto adminpanelchoice;
}
}

else if (main_menu_choice == 3)
{
cls();
middle1();
pre(3);
printf("Thank You For Using Our System \n\n\n\n\n\n\n");
Sleep(1000);

exit(1);
}
}
else
{
br(2);
pre(4);
printf("Please Enter Correct Choice");
Sleep(300);
goto mainmenu;
}

int get_food_choice;

br(2);
pre(3);
fflush(stdin);
printf("Place Your Order: ");
scanf("%d", &get_food_choice);

if (get_food_choice == 0)
{
goto mainmenu;
}

node *temp;

temp = list;

while (temp->data != get_food_choice)


{

temp = temp->next;
if (temp == NULL)
{
br(2);
pre(4);
echo("Please Choice From List ");
br(2);
Sleep(1000);
goto foodlist;
}
}
if (get_food_choice == temp->data)
{

fcquantity:
br(2);
pre(4);
printf("Enter Food Quantity : ");

int fcquantity;

fflush(stdin);
scanf("%d", &fcquantity);
cls();

if (fcquantity == 0)
{
cls();
middle1();
pre(3);
printf("Quantity Can not be Zero ");
Sleep(2000);
cls();
goto foodlist;
}
else if (fcquantity > temp->quantity)
{
cls();
middle1();
pre(3);
printf("Out of Stock ! ");
Sleep(2000);

goto foodlist;
}

middle1();
pre(4);
printf("Choice food %s its price is %0.2f \n\n", temp->foodname, temp-
>price * fcquantity);
pre(4);
printf("1. Confirm to buy this \n\n");
pre(4);
printf("2. Food List ");
int confirm;
confirm:

fflush(stdin);
scanf("%d", &confirm);

if (confirm == 1)
{

br(2);
pre(4);
printf(" 1. Cash ");
br(2);
pre(4);
printf(" 2. Credit ");
int payment;
payment:

fflush(stdin);
scanf("%d", &payment);

if (payment == 1)
{

totalmoney += temp->price * fcquantity;


order++;
total_order[order] = get_food_choice;
order_quantity[order] = fcquantity;
uquantity = temp->quantity - fcquantity;

updatefood(get_food_choice, uquantity);

cls();
middle1();
pre(4);
printf("===>THANK YOU<===");
br(2);
pre(4);
printf("Food Ordered Successfully ...");
br(2);
pre(4);
printf("1. Do you want to buy any other item? ");
br(2);
pre(4);
printf("2. Main Menu ");
int ps_menu;
psmenu:

fflush(stdin);
scanf("%d", &ps_menu);

if (ps_menu == 1)
{
goto foodlist;
}
else if (ps_menu == 2)
{
goto mainmenu;
}
else
{
br(2);
pre(4);
printf("Please Choice from list : ");
goto psmenu;
}
}

/// Credit Card Option

else if (payment == 2)
{

int card_number[100];

c++;

cls();
middle1();
pre(4);
printf("Enter Your Card No : ");

fflush(stdin);
scanf("%d", &card_number[c]);

cardno[c] = card_number[c];

br(2);
pre(2);
printf("Enter Your Card Pin : ");

fflush(stdin);
// scanf("%d",&pin);
int p = 0;
char pin[20];
do
{
pin[p] = getch();
if (pin[p] != '\r')
{
printf("*");
}
p++;
} while (pin[p - 1] != '\r');
pin[p - 1] = '\0';
// printf("\nYou have entered %s as pin",pin);
getch();

cardmoney[c] = temp->price * fcquantity;

totalmoney += temp->price * fcquantity;


order++;
total_order[order] = get_food_choice;
order_quantity[order] = fcquantity;

uquantity = temp->quantity - fcquantity;

updatefood(get_food_choice, uquantity);

br(2);
pre(4);
printf("Payment Success...");
br(2);
pre(4);
printf("1. Do you want to place another order ? ");
br(2);
pre(4);
printf("2. Main Menu ");
int ps_menu2;
psmenu2:
scanf("%d", &ps_menu2);

if (ps_menu2 == 1)
{
goto foodlist;
}
else if (ps_menu2 == 2)
{
goto mainmenu;
}
else
{
br(2);
pre(4);
printf("Please Choice from list : ");
goto psmenu2;
}
}

else
{

br(2);
pre(4);
printf("Enter Choice from List : ");

goto payment;
}

} /// END Confirm Y/y

else if (confirm == 2)
{

goto foodlist;
}

else
{
br(2);
pre(4);
printf("Enter choice from List : ");

goto confirm;

} /// end confirm;

} /// end get food choice if line

else
{
br(2);
pre(4);
echo("Please Choice From List ");
br(2);
Sleep(300);

goto foodlist;

} /// end get food choice


}

void cls()
{

system("cls");
}

void echo(char print[])


{

printf("%s", print);
}

void br(int line)


{
for (int i = 0; i < line; i++)
{
printf("\n");
}
}

void pre(int tab)


{

for (int i = 0; i < tab; i++)


{
printf("\t");
}
}
void span(int space)
{

for (int i = 0; i < space; i++)


{
printf(" ");
}
}

void main_menu()
{

cls();
br(5);
pre(3);
echo("===> 1. Food List");
Sleep(400);
br(2);
pre(3);
echo("===> 2. Admin Panel");
Sleep(400);
br(2);
pre(3);
echo("===> 3. Exit");
Sleep(400);
// br(2); pre(3); echo("=> 4. Admin Panel"); Sleep(400);

br(1);
}

void insertend(int data, char foodname[25], int quantity, float price)


{

node *temp;

temp = (node *)malloc(sizeof(node));

temp->data = data;

temp->price = price;

temp->quantity = quantity;

strcpy(temp->foodname, foodname);

temp->next = NULL;

if (head == NULL)
{
head = temp;
list = head;
}
else
{

while (head->next != NULL)


{
head = head->next;
}

head->next = temp;
}
}

void insertfirst(int data, char foodname[25], int quantity, float price)


{

node *temp;

temp = (node *)malloc(sizeof(node));

temp->data = data;

temp->price = price;

strcpy(temp->foodname, foodname);

temp->quantity = quantity;

temp->next = head;

head = temp;

list = head;
}

void insertmid(int pos, int data, char foodname[25], int quantity, float price)
{

node *temp;

temp = (node *)malloc(sizeof(node));

temp->data = data;

temp->price = price;

temp->quantity = quantity;

strcpy(temp->foodname, foodname);

while (head->next->data != pos)


{

head = head->next;
}

temp->next = head->next;
head->next = temp;

// free(temp);
}

void deletefood(int serial)


{

node *temp;
temp = (node *)malloc(sizeof(node));

temp = list;

if (temp->data != serial)
{

while (temp->next->data != serial)


{
temp = temp->next;
}

if (temp->next->data == serial)
{

temp->next = temp->next->next;
cls();
printf("\n\n\n\n\t\t\tDeleting Item %d ", serial);
for (int cs = 0; cs < 4; cs++)
{
printf(" .");
Sleep(400);
}

printf("\n\n\n\n\t\t\tDeleted Successfylly \n");


Sleep(500);
}
else
{
printf("\n\n\n\n\t\t\tFood Item Not Found\n");
Sleep(500);
}

head = temp;
}
else
{

temp = temp->next;
cls();
printf("\n\n\n\n\t\t\tDeleting Item %d ", serial);
for (int cs = 0; cs < 4; cs++)
{
printf(" .");
Sleep(400);
}

printf("\n\n\n\n\t\t\tDeleted Successfylly \n");


Sleep(500);

head = temp;
list = head;
}
}

void updatefood(int udata, int uquantity)


{

node *temp;
temp = list;

while (temp->data != udata)


{
temp = temp->next;
}
if (temp->data == udata)
{
temp->quantity = uquantity;
}
}

int countitem()
{

node *temp;

temp = list;

int countitem = 0;

if (temp == NULL)
{
countitem = 0;
}
else
{
countitem = 1;
while (temp->next != NULL)
{
countitem++;
temp = temp->next;
}
}

return countitem;
}
void foodlist()
{

ccolor(26);

printf("\n\t\t");
ccolor(240);
printf("______________________________________________________ ");
ccolor(26);
printf("\n\t\t");
ccolor(240);
printf("| Food No. | FooD Name | Price | In Stock |");
ccolor(26);
printf("\n\t\t");
ccolor(240);
printf("-------------------------------------------------------");
ccolor(26);

node *temp;

temp = list;

while (temp != NULL)


{

ccolor(26);

printf("\n\t\t");
ccolor(62);
printf("| %d | %s | %0.2f | %d |", temp->data,
temp->foodname, temp->price, temp->quantity);
ccolor(26);
printf("\n\t\t");
ccolor(62);
printf("-------------------------------------------------------");

temp = temp->next;

Sleep(100);
}

ccolor(26);

// free(temp);
}

void order_view(int order, int quantity, int or_no)


{

ccolor(26);

node *temp;

temp = list;

while (temp->data != order)


{

temp = temp->next;
}
if (temp->data == order)
{

ccolor(26);

printf("\n\t\t");
ccolor(62);
printf("| %d | %s | %d | %d |", or_no,
temp->foodname, quantity, temp->quantity);
ccolor(26);
printf("\n\t\t");
ccolor(62);
printf("-------------------------------------------------------");

Sleep(100);
}

ccolor(26);
}

void ccolor(int clr)


{

HANDLE hConsole;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, clr);
}

/// HEERE PRINTF STYLE FUNCTION

void pwellcome()
{
ccolor(26);

char welcome[50] = "WELCOME";


char welcome2[50] = " TO";
char welcome3[50] = " FOOD ORDER";
char welcome4[50] = " MANAGEMENT SYSTEM";
printf("\n\n\n\n\n\t\t\t");
for (int wlc = 0; wlc < strlen(welcome); wlc++)
{
ccolor(120 + (wlc * 9));

printf(" %c", welcome[wlc]);


Sleep(200);
}
ccolor(26);
printf("\n\n\t\t\t\t ");
for (int wlc2 = 0; wlc2 < strlen(welcome2); wlc2++)
{
ccolor(160 + (wlc2 * 9));
printf(" %c", welcome2[wlc2]);
Sleep(200);
}
ccolor(26);
printf("\n\n\n\t\t\t ");
for (int wlc3 = 0; wlc3 < strlen(welcome3); wlc3++)
{
if (welcome3[wlc3] != 'D')
{
ccolor(121 + (wlc3 * 4));

printf(" %c", welcome3[wlc3]);


}
else
{
ccolor(11);

printf(" %c", welcome3[wlc3]);


}

Sleep(200);
}
ccolor(26);
printf("\n\n\n\t\t\t\t ");
for (int wlc3 = 0; wlc3 < strlen(welcome4); wlc3++)
{
if (welcome4[wlc3] != 'A' && welcome4[wlc3] != 'E')
{
ccolor(121 + (wlc3 * 4));

printf(" %c", welcome4[wlc3]);


}
else
{
ccolor(11);

printf(" %c", welcome4[wlc3]);


}
Sleep(200);
}
ccolor(26);
}
void loadingbar(void)
{

for (int i = 15; i <= 100; i += 5)


{

cls();
ccolor(26);
printf("\n\n\n\n\n\n\n\t\t\t\t");
printf("%d %% Loading...\n\n\t\t", i);

printf("");

for (int j = 0; j < i; j += 2)


{

ccolor(160 + j);
printf(" ");
ccolor(26);
}
Sleep(100);
if (i == 90 || i == 50 || i == 96 || i == 83)
{
Sleep(100);
}
}
}
void backuploader(void)
{

for (int i = 15; i <= 100; i += 5)


{

cls();
ccolor(26);

printf("\n\n\n\n\n\n\n\t\t\t\t");
printf("%d %% Backing UP DATA...\n\n\t\t", i);

printf("");

for (int j = 0; j < i; j += 2)


{

ccolor(120 + j);
printf(" ");
ccolor(26);
}
Sleep(50);
if (i == 90 || i == 50 || i == 96 || i == 83)
{
Sleep(50);
}
}
}

void middle1(void)
{

printf("\n\n\n\n\n\n\n");
}

void middtab1(void)
{
printf("\t\t\t\t\t");
}

You might also like