Professional Documents
Culture Documents
GROUP PROJECT
ONLINE FOOD ORDERING SYSTEM-TOMATO
CB.EN.U4CHE20026
KOPPIREDDY KARTHIK REDDY
Problem Statement:
To Develop Online Food Ordering System TOMATO. Through our website and mobile application
life becomes easier. Food gets delivered directly at your doorsteps with a few taps from your device
with all safety precautions needed to be taken care off while preparing the food and as well as while
delivering it to the customer.
Functionalities:
1. Customer Signup
Here Customer signs up for a new account in the online food Ordering system TOMATO, with his
credentials like Name, age, Email address, and mobile number.
2. Validating Customer’s details
In this stage, this functionality checks with the default criteria meetup of inputs entered by Customer.
From here we are calling the validate function to validate the inputs.
Following are the functionalities to be validated:
1. Input the username: Username must contain alphabets.
2. Age: Must be greater than and not equal to 0.
3. Email Address: Email must contain @, a comma and length should be greater than 5.
4. Password: Passwords must contain length between 8 to 12 with at least one uppercase, lowercase,
number and a special character
5. Confirm the password: Both password and confirm password should be the same.
6. Mobile number: Mobile number should contain numbers and exactly 10 digits
3. Checking whether this account existed already or not
account_check(); is used to do the required job at this moment.
After the successful validation of all input fields, it checks whether the same account already exists or
not through account_check() functionality
4. Login Functionality:
This function implements the login features of our project. While login, the Email, and Password are
validated and checked whether it is already signed up.
5. Search by food and Search by hotels functionality:
After successful login of the customer there is an option to choose either Search_by_food() or
Search_by_hotels() functionalities.
6. Order by Hotel:
In this functionality, the food order is placed after selecting any Hotel. Once the hotel is selected the
list of food is displayed with their respective costs.
7. Order by Food:
Once the hotel is selected in the above step, search and select the food and enter the number of items
to order. Once the selection of all the foods is done it will display the total amount of food selected.
Once the food is selected, you need to go to option Select Cart for the successful ordering of the
foods. Move to Select Cart for the successful ordering of the foods.
8. Cart functionality:
This functionality performs the following: Display the total cost of your orders, Confirm your order
by providing payment methods and delivers your food through a assigned valet to enjoy your ordered
food.
CODE:
//C program to implement the online Food Ordering System, TOMATO.
#include <stdio.h>
#include <string.h>
#include <math.h>
struct details {
char uname[100];
int age;
char password[100];
char email[100];
char mobile[10];
};
struct hotels {
char hotel[100];
char first_food[20];
char second_food[20];
char third_food[20];
char fourth_food[25];
};
void account_check();
int validate();
void login();
void cart();
void search_by_hotels();
void search_by_food();
int search_choice;
void Search_by()
printf("Exit\n\nPlease Enter");
printf("your choice\t");
scanf("%d", &search_choice);
switch (search_choice) {
case 1: {
search_by_hotels();
break;
case 2: {
search_by_food();
break;
case 3: {
// exit(1);
return;
default: {
break;
}
}
void hotel_initialize();
char temp_mobile[100];
int main()
while (1) {
printf("\n\n\t\t'Welcome to TOMATO'\n");
printf("2)LOGIN\n3)EXIT\n\n");
scanf("%d", &choice);
switch (choice) {
case 1: {
signup();
break;
case 2: {
login();
break;
case 3: {
// exit(1);
return 0;
default: {
break;
}
//Function to create a new user for the Food ordering system, TOMATO
void signup()
scanf("%s", temp_name);
scanf("%d", &temp_age);
scanf("%s", temp_email);
scanf("%s", temp_password1);
scanf("%s", temp_password2);
scanf("%s", temp_mobile);
x = validate();
if (x == 1)
account_check();
int validate()
flag = 0;
break;
if (flag == 1) {
count = 0;
for (i = 0;
if (temp_email[i] == '@'
|| temp_email[i] == '.')
count++;
if (count >= 2
// Validating the Password and Check whether it matches with Conform Password
if (!strcmp(temp_password1,
temp_password2)) {
if (strlen(temp_password1) >= 8
caps = 0;
small = 0;
numbers = 0;
special = 0;
i++) {
caps++;
&& temp_password1[i]
<= 'z')
small++;
&& temp_password1[i]
<= '9')
numbers++;
|| temp_password1[i] == '&'
|| temp_password1[i] == '#'
|| temp_password1[i]
== '*')
special++;
if (strlen(temp_mobile) == 10) {
if (temp_mobile[i]
>= '0'
&& temp_mobile[i]
<= '9') {
success = 1;
else {
printf("\n\nPlease ");
printf("Mobile "
"Number\n\n");
return 0;
break;
if (success == 1)
return 1;
else {
printf("number\n\n");
return 0;
else {
return 0;
else {
printf("special character\n\n");
return 0;
else {
printf("between 8 to 12\n\n");
return 0;
else {
printf("\nPassword Mismatch\n\n");
return 0;
else {
printf("\nPlease Enter"
return 0;
void account_check()
// Check whether the email and password are already matched with existed account
if (!(strcmp(temp_email, s[i].email)
&& strcmp(temp_password1,
s[i].password))) {
main();
break;
}
// if account does not already existed, it creates a new one with new inputs
if (i == 100) {
strcpy(s[j].uname, temp_name);
s[j].age = temp_age;
strcpy(s[j].password, temp_password1);
strcpy(s[j].email, temp_email);
strcpy(s[j].mobile, temp_mobile);
j++;
printf("\n\n\nAccount Successfully");
printf(" Created!!\n\n");
void login()
printf("\n\nLOGIN\n\n");
scanf("%s", temp_email);
scanf("%s", temp_password1);
if (!strcmp(s[i].email, temp_email)) {
if (!strcmp(s[i].password, temp_password1)) {
Search_by();}
else {
printf("correct password\n\n");
main();
break;
else {
main();
break;
//initialzer
void hotel_initialize()
strcpy(m[1].first_food, "Sandwich");
strcpy(m[1].second_food, "Pizza");
strcpy(m[1].third_food, "Fried_Rice");
m[1].first = 70;
m[1].second = 100;
m[1].third = 95;
strcpy(m[2].hotel, "EMERALD");
strcpy(m[2].first_food, "Parotta");
strcpy(m[2].second_food, "Noodles");
strcpy(m[2].third_food, "Chicken_Rice");
m[2].first = 15;
m[2].second = 75;
m[2].third = 80;
strcpy(m[3].first_food, "Chicken_Biriyani");
strcpy(m[3].second_food, "Prawn");
strcpy(m[3].third_food, "Faloda");
m[3].first = 90;
m[3].second = 120;
m[3].third = 35;
void search_by_hotels()
hotel_initialize();
printf(""
m[1].hotel,
m[2].hotel, m[3].hotel);
scanf("%d", &hotel_choice);
if (hotel_choice > 4) {
search_by_hotels();
else if (hotel_choice == 4)
// exit(1);
Search_by();
else
hotels(hotel_choice);
totalh;
while (1) {
//foods available in
//selected hotel
m[hotel_choice].hotel,
m[hotel_choice].first_food,
m[hotel_choice].first);
printf("%s\tRs: %d\n3) %s\tRs: %d\n4)",
m[hotel_choice].second_food,
m[hotel_choice].second,
m[hotel_choice].third_food,
m[hotel_choice].third);
printf("Your Choice:\t");
scanf("%d", &food_choice);
if (food_choice == 1) {
printf("Count of %s\t",
m[hotel_choice].first_food);
scanf("%d", &n);
totalh = totalh
+ (n * m[hotel_choice].first);
else if (food_choice == 2) {
printf("of %s\t",
m[hotel_choice].second_food);
scanf("%d", &n);
totalh = totalh
+ (n * m[hotel_choice].second);
else if (food_choice == 3) {
printf("of %s\t",
m[hotel_choice].third_food);
scanf("%d", &n);
totalh = totalh
+ (n * m[hotel_choice].third);
//Once the user, completed their order, they can go to cart by giving choice as 4.
else if (food_choice == 4) {
cart();
else if (food_choice == 5) {
search_by_hotels("");
else {
printf("valid Choice\n\n");
void search_by_food()
scanf("%d",&food);
if(food==1)
{int hotel_CH,Food_CH,nf,CH;
do{
printf("1)Pav Bhaji\n2)Sandwich\n3)PaniPuri\n4)Jalebi\n5)Dhokla\n");
scanf("%d",&Food_CH);
if(Food_CH==1)
scanf("%d",&hotel_CH);
if(hotel_CH==1)
scanf("%d",&nf);
totalf=totalf+(nf*90);
else if(hotel_CH==2)
scanf("%d",&nf);
totalf=totalf+(nf*100);
else{
}
}
else if(Food_CH==2)
scanf("%d",&hotel_CH);
if(hotel_CH==1)
scanf("%d",&nf);
totalf=totalf+(nf*100);
else if(hotel_CH==2)
scanf("%d",&nf);
totalf=totalf+(nf*70);
else{
else if(Food_CH==3)
scanf("%d",&hotel_CH);
if(hotel_CH==1)
scanf("%d",&nf);
totalf=totalf+(nf*40);
else if(hotel_CH==2)
scanf("%d",&nf);
totalf=totalf+(nf*40);
else{
else if(Food_CH==4)
scanf("%d",&hotel_CH);
if(hotel_CH==1)
scanf("%d",&nf);
totalf=totalf+(nf*30);
else if(hotel_CH==2)
scanf("%d",&nf);
totalf=totalf+(nf*40);
else{
else if(Food_CH==5)
scanf("%d",&hotel_CH);
if(hotel_CH==1)
scanf("%d",&nf);
totalf=totalf+(nf*30);
else if(hotel_CH==2)
scanf("%d",&nf);
totalf=totalf+(nf*40);
else{
else{
scanf("%d",&CH);
}while(CH==1);
search_by_food();
else if(food==2)
cart();
else if(food==3)
Search_by();
else{printf("\nInvalid Choice\n");
search_by_food();}
void cart()
int MP,CVV,CN,dcount;
total=totalf+totalh;
printf("\n\n\n\n--------------Cart");
printf("----------------");
printf("order (y=1/n=0):");
scanf("%d", &ch);
if (ch == 1) {do{
scanf("%d", &MP);
if(MP==1)
{
do{
scanf("%d", &CN);
dcount=0;
while(CN!=0){
dcount=dcount+1;
CN=CN/10;
}while(dcount!=10);
do{
scanf("%d",&CVV);
}while(CVV<6);
else if(MP==2)
printf("\nYou have selected the cash on delivery mode.\nYou have successfully placed the order. The order will be delivered shortly");
else if(MP==3)
printf("\nYour order has been placed successfully. You can collect your parcel.");
printf("the way. Our Tomato valet will reach you soon with the food. Stay safe, Welcome again!!\n\n");
// exit(1);
total=0;
totalf=0;
totalh=0;
login();
else if (ch == 0) {
scanf("%d", &confirm);
if (confirm == 1) {
printf("cancelled!! Exiting..");
// exit(1);
return;
else {
printf("\n\nThank You\n\n");
login();
else {
printf("correct choice\n\n");
cart();
Sample outputs:
For successful creation of account
For customer login
Searching by hotels
To select multiple food items from the same restaurant and entering the cart to
calculate total bill
Continuing further to complete the billing