Professional Documents
Culture Documents
Ice Cream Parlour Mnagement System
Ice Cream Parlour Mnagement System
ICE-CREAM PARLOR
MANAGEMENT
SYSTEM
SUBMITTED TO: AQSA SAYEED
TEAM MEMBER
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:
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
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;
}
}
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
}
fclose(file);
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
{
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;
if (!found) {
printf("Flavor not found.\n");
remove("temp.txt");
return;
}
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: