Customer Billing System
Customer Billing System
Group Members
S.no Roll no. Name Reg no.
1
2
3
4
Submitted By :
Submitted to :
Acknowledgement
I would like to express my gratitude to all those who have contributed to the
successful completion of my CSE101 Computer Programming final project report.
First and foremost, I would like to thank my instructor for providing me with the
knowledge and guidance needed to complete this project. Their unwavering
support and constructive feedback have been invaluable throughout the process.
Lastly, I would like to express my heartfelt thanks to my family and friends for their
love, encouragement, and motivation throughout my academic journey. Their
unwavering support has been instrumental in helping me achieve my goals.
Modules
The Customer Billing System project consists of five modules that perform
specific tasks. These modules are described below:
struct MenuItem
{
char name[50];
char type[20];
float price;
float discount;
};
void displayMenu()
{
printf("Menu:\n");
for (int i = 0; i < menuCount; i++)
{
printf("%d. %s (%s) - %.2f\n", i + 1, menu[i].name,
menu[i].type, menu[i].price);
}
}
void addItem()
{
char name[50];
char type[20];
float price;
float discount;
printf("Enter name of item: ");
scanf("%s", name);
printf("Enter type of item: ");
scanf("%s", type);
printf("Enter price of item: ");
scanf("%f", &price);
printf("Enter discount of item: ");
scanf("%f", &discount);
struct MenuItem newItem = {.price = price, .discount = discount};
strcpy(newItem.name, name);
strcpy(newItem.type, type);
menu[menuCount] = newItem;
menuCount++;
printf("Item added successfully!\n");
}
void deleteItem()
{
int index;
printf("Enter the item number to delete: ");
scanf("%d", &index);
if (index < 1 || index > menuCount)
{
printf("Invalid item number.\n");
return;
}
for (int i = index - 1; i < menuCount - 1; i++)
{
menu[i] = menu[i + 1];
}
menuCount--;
printf("Item deleted successfully!\n");
}
void applyDiscount()
{
float discount;
printf("Enter the discount percentage: ");
scanf("%f", &discount);
for (int i = 0; i < menuCount; i++)
{
menu[i].discount = discount;
}
printf("Discount applied successfully!\n");
}
void makePayment()
{
float total = 0;
float discountTotal = 0;
char mode[20];
printf("Menu:\n");
for (int i = 0; i < menuCount; i++)
{
printf("%d. %s (%s) - %.2f\n", i + 1, menu[i].name,
menu[i].type, menu[i].price);
total += menu[i].price;
discountTotal += menu[i].price * (menu[i].discount / 100);
}
printf("Total: %.2f\n", total);
printf("Discount: %.2f\n", discountTotal);
printf("Net Total: %.2f\n", total - discountTotal);
printf("Enter the payment mode: ");
scanf("%s", mode);
printf("Payment made successfully using %s.\n", mode);
}
int main()
{
int choice;
while (1)
{
printf("Welcome to the restaurant menu system.\n");
printf("Please select an option:\n");
printf("1. Display menu\n");
printf("2. Add item\n");
printf("3. Delete item\n");
printf("4. Apply discount\n");
printf("5. Make payment\n");
printf("6. Exit\n");
printf("Enter Your Choice from above : ");
scanf("%d", &choice);
switch (choice)
{
case 1:
displayMenu();
break;
case 2:
addItem();
break;
case 3:
deleteItem();
break;
case 4:
applyDiscount();
break;
case 5:
makePayment();
break;
case 6:
printf("Thank you for using the restaurant menu system.\n");
exit(0);
default:
printf("Invalid choice. Please try again.\n");
break;
}
}
return 0;
}
Output:
Thank You