Project Report on-RMS (AutoRecovered)
Project Report on-RMS (AutoRecovered)
Name:
ID:
Batch:
Department: CSE
Subject:
Assignment On
“Food Order Managing System”
ABSTRACT
Introduction
Advantages:
Easy to use
Fully Customizable
Cost Effective Solution
Time & Energy Saving
Sustainable
Disadvantages:
Limited time file save format
Current Version is not visually attractive
Only a very few features are available
Future Work:
Enabling customers to customize food orders and reservation system
To save payment details for future use
Add more exciting features
Make it more visually attractive
We can conclude it saying that all of that is accomplished through the use
of an easy-to-use FOMS software. Through this software users may order
as many items as they like from any of the listed food. And then the order
will be automatically evaluated and a respective bill will be generated
immediately and order will be served through the restaurants’ serving
window on “First In First Served” basis. Ultimately, it provides us with hope
and pride to help to redesign the post pandemic restaurant business
structure of our local area.
Project Code:
/*
This code is for Data Structure Lab project- and it is written by:
ID: 202-15-3818 Name: Md. Rabby Hossain Khan, email: rabby15-3818@diu.edu.bd
ID: 203-15-3900 Name: Abu Darda Jubaer, email: jubaer15-3900@diu.edu.bd
ID: 203-15-3908 Name: Asif Haider, email: asif15-3908@edu.diu.bd
ID: 203-15-3921 Name: Ratul karim, email: md15-3921@diu.edu.bd
ID: 203-15-3923 Name: Biplob Kumar Sutradhar, email: biplob15-3923@diu.edu.bd
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include <time.h>
struct node
{
char foodname[50];
int quantity;
float price;
int data;
int time;
time_t timestamp;
struct node *prev;
struct node *next;
};
struct node *headc = NULL,*newnode,*tailc = NULL;
struct node *heada = NULL, *taila = NULL;
struct node *head_s;
void banner(int n)
{
system("cls");
printf("\n ********************
******************************************************\n");
if(n==0){
char *string = "WELCOME TO FOOD ORDER SYSTEM";
printf("%100s\n", string);
}else if(n==1){
char *string = "Place your order";
printf("%90s\n", string);
}else if(n==2){
char *string = "List of ordered items";
printf("%90s\n", string);
}else if(n==4){
char *string = "Final Bill";
printf("%90s\n", string);
}else if(n==5){
char *string = "View total sales";
printf("%90s\n", string);
}
printf(" **********************
****************************************************\n");
}
void goBack(){
getchar();
printf("\t\t\t\t\t\t\t Press enter key to return to main menu...");
getchar();
}
void menu()
{
printf("\n\t\t\t\t\t\t\t1. Place your order\n");
printf("\t\t\t\t\t\t\t2. View and delete your ordered items\n");
printf("\t\t\t\t\t\t\t3. Display final bill\n");
printf("\t\t\t\t\t\t\t4. View total sales\n");
printf("\t\t\t\t\t\t\t5. Exit \n\n");
printf("\t\t\t\t\t\t\t Enter Your Choice --->");
}
struct node* addFood(struct node *head,int data, char foodname[25], float price,
int time)
{
newnode = (struct node*)malloc(sizeof(struct node));
newnode->data = data;
newnode->price = price;
newnode->time = time;
newnode-> quantity = 0;
strcpy(newnode->foodname,foodname);
newnode->next = NULL;
newnode->prev = NULL;
struct node *temp = head;
if(temp==NULL)
heada = taila = newnode;
else
{
while(temp->next!=NULL)
temp=temp->next;
temp->next=newnode;
newnode->prev = taila;
taila = newnode;
}
return heada;
}
struct node* create(struct node *head,int data,int quantity)
{
newnode = (struct node*)malloc(sizeof(struct node));
struct node *temp1 = heada;
int flag = 0;
time_t t;
struct tm ttm;
while(temp1!=NULL)
{
if(temp1->data==data)
{
flag = 1;
break;
}
temp1 = temp1->next;
}
if(flag==1)
{
t = time(NULL);
newnode->data = data;
newnode->price = quantity*(temp1->price);
t += temp1->time*60;
newnode->time = temp1->time;
newnode->timestamp = t;
newnode-> quantity = quantity;
strcpy(newnode->foodname,temp1->foodname);
newnode->next = NULL;
newnode->prev = NULL;
struct node *temp = head;
if(temp==NULL)
headc = tailc = newnode;
else
{
while(temp->next!=NULL)
temp=temp->next;
temp->next=newnode;
newnode->prev = tailc;
tailc = newnode;
}
ttm = * localtime(&newnode->timestamp);
printf("\t\t\t\t\t\t\t Your order will be surved in %02d minutes or %02
d:%02d\n", newnode->time, ttm.tm_hour, ttm.tm_min);
}
else
{
printf("\n\t\t\t\t\t\t\tThis item is not present in the menu!\n");
}
return headc;
}
void displayList(struct node *head)
{
struct node *temp1 = head;
time_t t;
struct tm *ttm;
t = time(NULL);
if(temp1==NULL)
{
printf("\n\t\t\t\t\t\t\t\tList is empty!!\n\n");
}
else
{
printf("\n");
char *name = "Food Name";
if(temp1->quantity==0){
printf("\t\t\t\t\t\t\tProduct ID\t%22s\tPrice\n",name);
}else{
printf("\t\t\t\t\t\t\tProduct ID\t%22s\t Quantity\tPrice\tServed ET
C\n",name);
}
while(temp1!=NULL)
{
if(temp1->quantity==0)
printf("\t\t\t\t\t\t\t%d\t%30s\t%0.2f\n",temp1->data,temp1-
>foodname,temp1->price);
else
{
if (t<temp1->timestamp){
ttm = localtime(&temp1->timestamp);
printf("\t\t\t\t\t\t\t%d\t%30s\t\t%d\t%0.2f\t%02d:%02d\
n",temp1->data,temp1->foodname,temp1->quantity,temp1->price, ttm->tm_hour, ttm-
>tm_min);
}else
printf("\t\t\t\t\t\t\t%d\t%30s\t\t%d\t%0.2f\tServed\
n",temp1->data,temp1->foodname,temp1->quantity,temp1->price);
}
temp1 = temp1->next;
}
printf("\n");
}
struct node* totalSales(int data,int quantity, time_t timestamp)
{
newnode = (struct node*)malloc(sizeof(struct node));
int flag = 0;
struct node *temp1 = heada;
while(temp1->data!=data)
{
temp1 = temp1->next;
}
newnode->data = data;
newnode->price = quantity*(temp1->price);
newnode->quantity = quantity;
newnode->time = temp1->time;
newnode->timestamp = timestamp;
strcpy(newnode->foodname,temp1->foodname);
newnode->next = NULL;
newnode->prev = NULL;
struct node *temp = head_s;
if(temp==NULL)
head_s = newnode;
else
{
while(temp->next!=NULL)
{
if(temp->data==data)
{
flag = 1;
break;
}
temp=temp->next;
}
if(flag==1)
{
temp->quantity += newnode-> quantity;
temp->price += newnode->price;
}
else
{
temp->next=newnode;
}
}
return head_s;
}
void calculateToTSales()
{
struct node *temp = headc;
while(temp!=NULL)
{
head_s = totalSales(temp->data, temp->quantity, temp->timestamp);
temp=temp->next;
}
}
struct node* delete(int data,struct node *head, struct node* tail)
{
if(head==NULL)
{
printf("\n\t\t\t\t\t\t\tList is empty\n");
}
else
{
struct node* temp;
if(data==head->data)
{
temp = head;
head = head->next;
if (head != NULL)
head->prev = NULL;
free(temp);
}
else if(data==tail->data)
{
temp = tail;
tail = tail->prev;
tail->next = NULL;
free(temp);
}
else
{
temp = head;
while(data!=temp->data)
{
temp = temp->next;
}
(temp->prev)->next = temp->next;
(temp->next)->prev = temp->prev;
free(temp);
}
}
return head;
}
int deleteFood()
{
printf("\n\t\t\t\t\tEnter Product ID. of the food item which you want to be
deleted or -1 for go back main menu: ");
int num;
scanf("%d",&num);
if(num==-1)
return -1;
struct node* temp=headc;
while(temp!=NULL)
{
if (temp->data == num)
{
headc = delete(num, headc, tailc);
return 1;
}
temp=temp->next;
}
return 0;
}
void displayDetail(struct node *head, int m)
{
displayList(head);
struct node *temp = head;
float total_price = 0;
int total_order = 0;
while (temp!=NULL)
{
total_order++;
total_price +=temp->price;
temp = temp->next;
}
if(m==1){
printf("\t\t\t\t\t\t\tTotal Order: %d\n",total_order);
printf("\t\t\t\t\t\t\tTotal Earning: %0.02f\n",total_price);
}else
printf("\t\t\t\t\t\t\tTotal Price: %0.02f\n",total_price);
struct node* deleteList(struct node* head)
{
if(head==NULL)
{
return NULL;
}
else
{
struct node* temp = head;
while(temp->next!=0)
{
temp = temp->next;
free(temp->prev);
}
free(temp);
head = NULL;
}
return head;
}
void options()
{
int flag=0,j=1;
char ch;
while(1)
{
banner(0);
menu();
int opt;
scanf("%d",&opt);
if(opt==5)
break;
switch (opt)
{
case 1:
banner(1);
displayList(heada);
printf("\n\t\t\t\t\t\tEnter number corresponding to the item you
want to order: ");
int n;
scanf("%d",&n);
printf("\t\t\t\t\t\tEnter quantity: ");
int quantity;
scanf("%d",&quantity);
headc = create(headc, n, quantity);
printf("\n\t\t\t\t\t\t\tThank you! Your order was successfully s
ubmitted!\n");
goBack();
break;
case 2:
banner(2);
displayList(headc);
int x;
x = deleteFood();
if(x==1)
{
printf("\n\t\t\t\t\t\t### Updated list of your ordered food
items ###\n");
displayList(headc);
}
else if(x==0)
printf("\n\t\t\t\t\t\tFood item with given serial number doe
sn't exist!! Please try again.\n");
break;
case 3:
banner(3);
calculateToTSales();
displayDetail(headc, 0);
headc = deleteList(headc);
printf("\n\t\t\t\t\t\tHava nice day!\n");
printf("\t\t\t\t\t\tThanks your order.\n");
goBack();
break;
case 4:
banner(5);
displayDetail(head_s, 1);
goBack();
break;
default:
printf("\n\t\t\t\t\t\tWrong Input !! PLease choose valid option\
n");
goBack();
break;
}
}
}
int main()
{
heada = addFood(heada,1,"Phuchka",50, 1);
heada = addFood(heada,2,"CchotPoti",50, 5);
heada = addFood(heada,3,"Thai Soup",200, 10);
heada = addFood(heada,4,"Chicken Biriyani",130, 10);
heada = addFood(heada,5,"Fried Rice with vegetable",350, 10);
heada = addFood(heada,6,"Chicken Chowmein",120, 10);
heada = addFood(heada,7,"Kachchi Biryani",150, 10);
options();
}