You are on page 1of 16

Registration

S. No. Name Roll Number


Number

1 Anurag Pandey 12214595 K22EXA28

2 Vivek Sharma 12214634 K22EXA29

3 Sayantan Hutait 12214919 K22EXA30

Submitted To:

Dr Navneet Malik
Lovely Professional University Punjab, India
PROJECT STATEMENT

Title:
Ice-cream Parlor Management System

Description:
Through this project, users can manage the
different types of ice creams. The user will first
create the database for ice creams and then certain
operations can be performed depending on the
user's requirements.

Modules Required:
1. Display the Ice-creams list
2. Add new ice cream data
3. Update the record of the ice-cream
4. Search for any ice-cream
5. Delete any ice cream record
O LEVEL DFD

INSERT

SEARCH ICE CREAM PARLOUR UPDATE


MANAGEMENT
SYSTEM

DELETE
DISPLAY
SOLUTION CODE
#include <stdio.h>

char ice_cream[100][50];
int quantity[100];
int num_ice_cream = 0;

void display_ice_cream();
void add_ice_cream();
void delete_ice_cream();
void search_ice_cream();
void update_ice_cream();

int main()
{
int choice;
do
{
printf("\n******* ICE CREAM PARLOUR MANAGEMENT SYSTEM
*******\n\n");
printf("\t1. Display Ice Cream Detail\n");
printf("\t2. Add New Ice Cream\n");
printf("\t3. Delete Ice Cream\n");
printf("\t4. Search Ice Cream\n");
printf("\t5. Update Ice Cream\n");
printf("\t6. Exit\n");
printf("\n\tEnter your choice (1 to 6): ");
scanf("%d", &choice);
switch (choice)
{
case 1:
display_ice_cream();
break;
case 2:
add_ice_cream();
break;
case 3:
delete_ice_cream();
break;
case 4:
search_ice_cream();
break;
case 5:
update_ice_cream();
break;
case 6:
printf("\n............ Hope You Enjoy .............\n\n");
break;
default:
printf("Invalid choice!\n");
break;
}
} while (choice != 6);

return 0;
}
// function for displaying ICE CREAM

void display_ice_cream()
{
printf("\n\t---------- ICE CREAM DETAILS ----------\n");
if (num_ice_cream == 0)
{
printf("\t\tNo Ice Cream to display.\n");
}
else
{
printf("Ice Cream Name\t\t\tQuantity\n");
for (int i = 0; i < num_ice_cream; i++)
{
printf("%s\t\t\t%d\n", ice_cream[i], quantity[i]);
}
}
}

// function for adding new ICE CREAM

void add_ice_cream()
{
printf("\n\t---------- ADD NEW ICE CREAM ----------\n");
if (num_ice_cream == 100)
{
printf("Can not add more Ice Cream.\n");
}
else
{
printf("\tEnter Ice Cream name: ");
scanf(" %[^\n]", &ice_cream[num_ice_cream]);
printf("\tEnter Ice Cream quantity: ");
scanf("%d", &quantity[num_ice_cream]);
num_ice_cream++;
printf("\tIce Cream added successfully.\n");
}
}
// function for deleting ICE CREAM from the record

void delete_ice_cream()
{
printf("\n\t---------- DELETE ICE CREAM DETAILS-----------\n");
if (num_ice_cream == 0)
{
printf("\t\tNo Ice Cream to delete.\n");
return;
}
printf("\tEnter Ice Cream name to delete: ");
char ice_cream_name[50];
scanf(" %[^\n]", ice_cream_name);
int index = -1;
for (int i = 0; i < num_ice_cream; i++)
{
int j = 0;
while (ice_cream[i][j] != '\0' && ice_cream_name[j] != '\0' && ice_cream[i][j] ==
ice_cream_name[j])
{
j++;
}
if (ice_cream[i][j] == '\0' && ice_cream_name[j] == '\0')
{
index = i;
break;
}
}
if (index == -1)
{
printf("\t\tIce Cream not found.\n");
}
else
{
for (int i = index; i < num_ice_cream - 1; i++)
{
for (int j = 0; j < 50; j++)
{
ice_cream[i][j] = ice_cream[i + 1][j];
}
quantity[i] = quantity[i + 1];
}
num_ice_cream--;
printf("\t\tIce Cream deleted successfully.\n");
}
}
// function for searching ICE CREAM

void search_ice_cream()
{
printf("\n\t---------- SEARCH ICE CREAM -----------\n");
if (num_ice_cream == 0)
{
printf("\t\tNo Ice Cream to search.\n");
return;
}
printf("\tEnter Ice Cream name to search: ");
char ice_cream_name[50];
scanf(" %[^\n]", ice_cream_name);
int index = -1;
for (int i = 0; i < num_ice_cream; i++)
{
int j = 0;
while (ice_cream[i][j] != '\0' && ice_cream_name[j] != '\0' && ice_cream[i][j]
== ice_cream_name[j])
{
j++;
}
if (ice_cream[i][j] == '\0' && ice_cream_name[j] == '\0')
{
index = i;
break;
}
}
if (index == -1)
{
printf("\t\tIce Cream not found.\n");
}
else
{
printf("\t\tIce Cream Found\n");
printf("Ice Cream Name\tQuantity\n");
printf("%s\t\t%d\n", ice_cream[index], quantity[index]);
}
}
// function for updating ICE CREAM

void update_ice_cream()
{
printf("\n\t---------- UPDATE ICE CREAM -----------\n");
if (num_ice_cream == 0)
{
printf("\t\tNo Ice Cream to update.\n");
return;
}
printf("\tEnter Ice Cream name to update: ");
char ice_cream_name[50];
scanf(" %[^\n]", ice_cream_name);
int index = -1;
for (int i = 0; i < num_ice_cream; i++)
{
int j = 0;
while (ice_cream[i][j] != '\0' && ice_cream_name[j] != '\0' && ice_cream[i][j] ==
ice_cream_name[j])
{
j++;
}
if (ice_cream[i][j] == '\0' && ice_cream_name[j] == '\0')
{
index = i;
break;
}
}
if (index == -1)
{
printf("\t\tIce Cream not found.\n");
}
else
{
printf("Enter new Ice Cream name: ");
scanf(" %[^\n]", &ice_cream[index]);
printf("Enter new quantity: ");
scanf("%d", &quantity[index]);
printf("\t\tIce Cream updated successfully.\n");
}
}
SAMPLE OUTPUT
System Design
The system is designed using a struct `flavor` that contains the
name of the flavor and its stock. This struct is used to store the
information about each flavor. The system uses an array of this
struct to store information about all the flavors available in the
ice cream parlour.

The main function provides a menu of options for the user to


interact with the system. These options are as follows:

1. Add/Update Flavor: This option allows the user to add a new


flavor to the system. The user is prompted to enter the name of
the flavor and its stock. If the flavor already exists, the system
will display a message indicating that the flavor already exists. If
the maximum number of flavors has been reached, the system
will display a message indicating that the maximum number of
flavors has been reached.

2. Remove Flavor: This option allows the user to remove a flavor


from the system. The user is prompted to enter the name of the
flavor. If the flavor is found in the system, it is removed from the
array. If the flavor is not found, the system will display a message
indicating that the flavor was not found.

3. View/Search Available Flavors: This option allows the user to


view all the available flavors in the system. The system will
display the name of the flavor and its stock.

4. Exit: This option allows the user to exit the system.


Implementation
The system is implemented using C language. The system has
a global array of flavors and a global variable to keep track of
the number of flavors available in the system.

The system provides three functions:

1. add_ice_cream: This function adds a new flavor to the


system. The function takes two parameters - the name of the
flavor and its stock. The function first checks if the maximum
number of flavors has been reached. If the maximum number
of flavors has not been reached, the function checks if the
flavor already exists in the system. If the flavor does not
already exist, the function adds the new flavor to the array.

2. delete_ice_cream: This function removes a flavor from the


system. The function takes one parameter - the name of the
flavor. The function searches for the flavor in the array. If the
flavor is found, the function removes the flavor from the
array.

3. display_ice_cream: This function displays all the available


flavors in the system.

4.search_ice_cream: To display particular icecream with its


quantity

5.update_ice_cream: To update the particular ice creams'


quantity
The main function provides a menu of options for the user to
interact with the system. The main function uses a do-while
loop to repeatedly display the menu and prompt the user for
input until the user chooses to exit the system.
Testing
The system was tested with various test cases to ensure
that it is working as expected. The test cases covered all
the functions of the system, including adding a new
flavor, removing a flavor, and viewing available flavors.
The system was also tested with invalid input to ensure
that it could handle errors gracefully.

Conclusion
In conclusion, the Ice Cream Parlour Management
System is a simple yet effective system that allows the
owner of an ice cream parlour to manage the available
flavors. The system is designed using C language and
provides a menu of options for the user to interact with

You might also like