You are on page 1of 16

FINAL REPORT

ICE-CREAM PARLOR
MANAGEMENT
SYSTEM
SUBMITTED TO: AQSA SAYEED

TEAM MEMBER

Santhosh Mani Bharadwaj Jasir Ahmed Khan


12215828 12215952
38 40

Vishwas Kumar Sharma Swami Raj


12215869 12215991
39 41
DISTRIPTION:

The "Ice Cream Parlor Management System" is a C programming project


designed to automate the daily operations of an ice cream parlor. The main
goal of this project is to create an easy-to-use system that can manage all
aspects of the ice cream parlor business, including customer orders,
inventory management, and sales tracking. This project aims to simplify the
process of running an ice cream parlor by providing a user-friendly
interface for managing all operations.

The Ice Cream Parlor Management System has a range of features that
enable it to manage all aspects of an ice cream parlor business. Some of the
key features of the system include:

1. Inventory Management: The system has an inventory management


feature that enables the ice cream parlor to keep track of its stock
levels. This feature helps the parlor to avoid running out of ingredients
and ensures that they can fulfill customer orders promptly.

2. Customer Order Management: The system allows the parlor to manage


customer orders quickly and efficiently. It enables the parlor to keep
track of customer orders, including the type of ice cream ordered, the
quantity, and the price.
3. Sales Tracking: The system has a sales tracking feature that enables the
ice cream parlor to keep track of its sales. This feature helps the parlor
to monitor its sales performance and identify areas where it needs to
improve.
4. User-Friendly Interface: The Ice Cream Parlor Management System has
a user-friendly interface that is easy to use. This feature ensures that
the system can be used by anyone without requiring any specialized
training.
5. Reports Generation: The system has a feature that generates reports
that can be used to monitor the performance of the ice cream parlor.
These reports provide insight into sales performance, inventory levels,
and customer order patterns.
6. Security: The system is designed with security in mind, and it ensures
that the data is protected against unauthorized access. This feature
ensures that the data is safe and can be accessed only by authorized
personnel.
MODULE EXPLANATION:

main:
The main function of the program, responsible for handling user input and calling
other functions as needed.

add_ice_cream:
Function to add a new ice cream flavor to the system. It should prompt the user for
the name of the flavor, its price, and any other relevant information (e.g., ingredients,
popularity).

delete_ice_cream:
Function to delete an existing ice cream flavor from the system. It should prompt the
user for the name of the flavor to be deleted, and verify the deletion before removing
the record.

update_ice_cream:
Function to update an existing ice cream flavor in the system. It should prompt the
user for the name of the flavor to be updated, and then allow the user to modify any
of the relevant information (e.g., price, ingredients).

display_ice_creams:

Function to display a list of all the available ice cream flavors in the system. It should
show the name, price, and any other relevant information for each flavor.

search_ice_cream:
Function to search for an ice cream flavor by name or other attributes (e.g., price
range, popularity). It should prompt the user for the search criteria and display a list
of matching flavors.

place_order:
Function to place an order for one or more ice cream flavors. It should prompt the
user for the name(s) of the flavor(s) and the quantity desired. It should also calculate
the total cost of the order and display it to the user.

view_order_history:
Function to display a list of all the previous orders placed, including the date, time,
and details of each order (e.g., flavors, quantities, total cost).

save_data:
Function to save all the data in the system to a file, so that it can be loaded again
later.

load_data:
Function to load all the data from a previously saved file, so that the system can
resume where it left off.
DFD (LEVEL 0)

PROGRAMMING CODE

#include <stdio.h>
#include <string.h>

#define MAX_FLAVORS 10

typedef struct flavor


{
char name[20];
int stock;
} Flavor;

Flavor flavors[MAX_FLAVORS];
int num_flavors = 0;

void
add_flavor (char *name, int stock)

{
if (num_flavors == MAX_FLAVORS)
{
printf ("Maximum number of flavors reached.\n");
return;
}
for (int i = 0; i < num_flavors; i++); {
if (strcmp (flavors[i].name, name) == 0)
{
printf ("Flavor already exists.\n");
return;
}
}
Flavor new_flavor;
strcpy (new_flavor.name, name);
new_flavor.stock = stock;
flavors[num_flavors] = new_flavor;
num_flavors++;
printf ("Flavor added successfully.\n");
}
PROGRAMMING CODE

void
remove_flavor (char *name)
{
for (int i = 0; i < num_flavors; i++)
{
if (strcmp (flavors[i].name, name) == 0)
{
for (int j = i; j < num_flavors - 1; j++)
{
flavors[j] = flavors[j + 1];
}
num_flavors--;
printf ("Flavor removed successfully.\n");
return;
}
}

printf ("Flavor not found.\n");


}
void save_flavors_to_file()
{
FILE *f = fopen("flavors.txt", "w");
if (f == NULL)
{
printf("Error saving flavors to file.\n");
return;
}
for (int i = 0; i < num_flavors; i++)
{
fprintf(f, "%s %d\n", flavors[i].name, flavors[i].stock);
}
fclose(f);
printf("Flavors saved to file successfully.\n");
}
PROGRAMMING CODE

void
update_flavors (char *name, char *updated_name, int updated_stock)
{
for (int i = 0; i < num_flavors; i++)
{
if (strcmp (flavors[i].name, name) == 0)
{
strcpy(flavors[i].name,updated_name);
flavors[i].stock = updated_stock;
printf ("Flavor data updated successfully.\n");
return;
}
}
}

void

search (char *name)


{
for (int i = 0; i < num_flavors; i++)
{
if (strcmp (flavors[i].name, name) == 0)
{
printf ("%s - %d\n", flavors[i].name, flavors[i].stock);
return;
}
}
printf ("No data found for this Input");
}
void print_flavors ()
{
printf ("Flavors available:\n");
for (int i = 0; i < num_flavors; i++)
{
printf ("%s - %d\n", flavors[i].name, flavors[i].stock);
}
}
PROGRAMMING CODE

void load_flavors_from_file(char* filename)


{
FILE* file = fopen(filename, "r");
if (!file) {
printf("Error opening file %s\n", filename);
return;
}
char line[256];
while (fgets(line, sizeof(line), file)) {
char name[20];
int stock;
sscanf(line, "%s %d", name, &stock);
add_flavor(name, stock);
}

}
fclose(file);

void update_flavors_in_file(char *name, char *updated_name, int


updated_stock)
{
FILE *fp;
fp = fopen("flavors.txt", "r");
FILE *temp;
temp = fopen("temp.txt", "w");
PROGRAMMING CODE

char line[100];
while (fgets(line, 100, fp))
{
char flavor_name[20];
int stock;
sscanf(line, "%s %d", flavor_name, &stock);
if (strcmp(flavor_name, name) == 0)
{
if (updated_name != NULL)
{
fprintf(temp, "%s %d\n", updated_name, updated_stock);
}
else
{

fprintf(temp, "%s %d\n", name, updated_stock);


}
}
else
{
fprintf(temp, "%s %d\n", flavor_name, stock);
}
}
fclose(fp);
fclose(temp);
remove("flavors.txt");
rename("temp.txt", "flavors.txt");
}
PROGRAMMING CODE

void remove_flavor_from_file() {
char name[20];
printf("Enter flavor name to remove: ");
scanf("%s", name);

FILE *fp;
FILE *temp_fp;
fp = fopen("flavors.txt", "r");
temp_fp = fopen("temp.txt", "w");
if (fp == NULL || temp_fp == NULL) {
printf("Error opening file.\n");
return;
}

char buffer[1024];
int found = 0;

while (fgets(buffer, 1024, fp)) {


char *token = strtok(buffer, ",");
if (strcmp(token, name) == 0) {
// Found the flavor, skip this line
found = 1;
continue;
}
fputs(buffer, temp_fp);
}
fclose(fp);
fclose(temp_fp);

if (!found) {
printf("Flavor not found.\n");
remove("temp.txt");
return;
}
PROGRAMMING CODE

// Replace flavors.txt with temp.txt


remove("flavors.txt");
rename("temp.txt", "flavors.txt");

printf("Flavor removed successfully.\n");


}
int
main ()
{
load_flavors_from_file("flavors.txt");
int choice, stock;
char name[20];
char updated_name[20];
do
{
printf ("\n1. Add flavor\n");

printf ("2. Remove flavor\n");


printf ("3. View available flavors\n");
printf ("4. Update flavors\n");
printf ("5. Search flavors\n");
printf ("6. Exit\n");
printf ("Enter your choice: ");
scanf ("%d", &choice);
switch (choice)
{
PROGRAMMING CODE

case 1:
printf ("Enter flavor name: ");
scanf ("%s", name);
printf ("Enter stock: ");
scanf ("%d", &stock);
add_flavor (name, stock);
save_flavors_to_file("flavors.txt");
break;
case 2:
printf ("Enter flavor name: ");
scanf ("%s", name);
remove_flavor (name);
remove_flavor_from_file();
break;
case 3:
print_flavors ();

break;
case 4:
printf("Enter flavor name: ");
scanf("%s", name);
printf("Enter updated flavor name: ");
scanf("%s", updated_name);
printf("Enter updated stock: ");
scanf("%d", &stock);
update_flavors(name, updated_name, stock);
update_flavors_in_file(name, updated_name, stock);
break;
PROGRAMMING CODE

case 5:
printf ("Enter flavor name: ");
scanf ("%s", name);
search (name);
break;
case 6:
printf ("Exiting...\n");
break;
default:
printf ("Invalid choice.\n");
break;
}
while (choice != 6);
return 0;
}

CODE SNAPSHOTS:

CODE SNAPSHOTS:

CODE SNAPSHOTS:

You might also like