[go: up one dir, main page]

0% found this document useful (0 votes)
48 views17 pages

Durva Mehta CS Project

The Cafe Management System project develops a software solution using Python and SQL to streamline operations for cafes. The system allows users to view menus, place orders, and receive bills. It connects to a MySQL database to store and retrieve menu item and order data. The project implements functions for authentication, viewing menus and coffee types, placing orders, and generating receipts. It provides a simple yet effective way for cafes to manage ordering and billing.

Uploaded by

Krish Arora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views17 pages

Durva Mehta CS Project

The Cafe Management System project develops a software solution using Python and SQL to streamline operations for cafes. The system allows users to view menus, place orders, and receive bills. It connects to a MySQL database to store and retrieve menu item and order data. The project implements functions for authentication, viewing menus and coffee types, placing orders, and generating receipts. It provides a simple yet effective way for cafes to manage ordering and billing.

Uploaded by

Krish Arora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Computer Science Project

Cafe Management System

Name: Durva Vinay Mehta

Roll No.: __________________

School: Gujarat Public School


2
3
Index

Sr. No. Contents Pg. No.

1 Introduction 5

2 Requirements 6

3 Development Cycle 7

4 Source Code 9

5 Sample Output 12

6 Conclusion 16

7 Bibliography 17

4
Introduction
In today's fast-paced world, cafes have become more than just a place to enjoy a
cup of coffee; they have evolved into social hubs where people gather to work,
relax, and socialize. Managing a cafe efficiently to meet the diverse needs of
customers while maintaining profitability can be a daunting task. This is where
the Cafe Management System, developed using Python and SQL, comes into play.

The Cafe Management System is a comprehensive software solution that


leverages the power of modern technology to streamline and enhance the
management of a cafe. This project combines the versatility of the Python
programming language with the data management capabilities of SQL, offering a
robust and user-friendly system that can be customized to meet the specific
requirements of different cafes.

In this report, we will provide an in-depth analysis of the Cafe Management System
project, outlining its objectives, scope, design, functionality, and implementation.
We will also delve into the technology stack and tools used to develop this system,
highlighting how Python and SQL have been utilized to create a seamless and
efficient cafe management experience.

While the design is kept minimalistic, it sufficiently simulates a Cafe Management


System where users can enter their details, see the Menu, Order items and get
their Bills for the same.

5
Requirements
The requirements for this project include -

1. MySQL installed on the system


2. A database named “food_service”

○ Created with the command -

“CREATE DATABASE IF NOT EXISTS food_service”

3. A table named “branch_vadodara”


○ Created with the command -

“CREATE TABLE IF NOT EXISTS branch_vadodara(

sno INT,

product_name VARCHAR(20),

cost INT

)”

4. “mysql.connector” module to connect mysql with python


5. “tabulate” library - for properly formatting the outputs

6
Development Cycle

Phase 1: Planning
A. Database Design: Check that the requirements are met by the database
structure. Make any necessary modifications in light of this.
B. Functionality Specification: Documenting the expected behavior of a
program.

Phase 2: Implementation
I will be using functional programming throughout the implementation. The
following are key points kept in mind -

A. Database Connection: Connect to the database using User’s credentials.


B. Database Creation: Add dummy data for the cafe (To be done once only).
C. User Details: Ask for basic user details like Name and Contact Number, to use
during billing.
D. Main Prompt: Implementation for the Main() method that handles primary
user interaction. It has the following options available -
a. Menu
b. Order
c. Exit
E. Menu:
a. Shows the items present in the Cafe with their name and cost.
b. Implemented under the function named - “items()”
F. Exit: Terminates the running instance of the code. Opening another instance
uses the previously created database and tables instead of re-creating them.

7
G. Order:
a. Allows the user to Order items from the Cafe and generates the bills
for the same.
b. Implemented under the function named - “order()”, which internally
calls the following functions -
i. items()
ii. coffee()
iii. bill(amount)

Phase 3: Testing
A. Test all functions and commands in the program manually to find any errors.
B. Check all corner cases and ensure code works for those.

Phase 4: Refinement and Maintenance


A. Code Review: Perform a code review to find and address any problems,
enhance readability, and make sure best practices are being followed.
B. User Feedback: Modify the code in response to any input from users.

8
Source Code
# Importing libraries
from tabulate import tabulate
import mysql.connector

# Connecting to MySQL
con = mysql.connector.connect(host="localhost", user="root",
password="admin")
cur = con.cursor()

# Creating database and tables


cur.execute("create database if not exists food_service")
cur.execute("use food_service")

cur.execute(
"create table if not exists branch_vadodara(sno int, product_name
varchar(20), cost int)"
)
cur.execute("create table if not exists coffee_type(sno int, coffee_name
varchar(20))")

# Inserting values into tables for the first time


cur.execute("select * from branch_vadodara")
res = cur.fetchall()
if res == []:
cur.execute("insert into branch_vadodara values(1,'Coffee',100)")
cur.execute("insert into branch_vadodara values(2,'Burger',100)")
cur.execute("insert into branch_vadodara values(3,'Sandwich',50)")
cur.execute("insert into branch_vadodara values(4,'Pasta',150)")
cur.execute("insert into branch_vadodara values(5,'Pizza',200)")
con.commit()

cur.execute("select * from coffee_type")


res = cur.fetchall()

if res == []:
cur.execute("insert into coffee_type values(1,'Espresso')")
cur.execute("insert into coffee_type values(2,'Cappuccino')")
cur.execute("insert into coffee_type values(3,'Latte')")

9
cur.execute("insert into coffee_type values(4,'Americano')")
cur.execute("insert into coffee_type values(5,'Mocha')")
con.commit()

# Return items available in Vadodara branch


def items():
print("\n")
print("Items available in Vadodara branch are:\n")
cur.execute("select * from branch_vadodara")
res = cur.fetchall()
print(tabulate(res, headers=["S No.", "Product Name", "Cost"]))

# Return coffee types available


def coffee():
print("\n\nCoffee types available are:\n")
cur.execute("select * from coffee_type")
res = cur.fetchall()
print(tabulate(res, headers=["S No.", "Coffee Name"]))

# Print bill with customer details and amount


def bill(amt):
print("************************")
print("YOUR BILL: ")
print("Customer Name: ", name)
print("Customer Phone No.: ", phone)
print("Amount: ", amt)
print("Thank You for ordering with us!")

# Order items
def order():
items()
x = int(input("\nEnter the S No. of the item you want to order:"))
if x == 1:
coffee()
y = int(input("\nEnter the S No. of the coffee you want to order:"))
cur.execute("select * from coffee_type where sno=%d" % (y))
res = cur.fetchall()
print("\nYou have ordered", res[0][1], "coffee\n")

10
cur.execute("select * from branch_vadodara where sno=%d" % (x))
res = cur.fetchall()
bill(res[0][2])
else:
cur.execute("select * from branch_vadodara where sno=%d" % (x))
res = cur.fetchall()
print("\nYou have ordered", res[0][1])
print("")
bill(res[0][2])

# Main function to run the program continuously


def Main():
while True:
print("\n************************")
print("1. Menu")
print("2. Order")
print("3. Exit")
choice = input("Enter your choice:")
if choice == "1":
items()
elif choice == "2":
order()
elif choice == "3":
print("Thank You!")
exit()

# Welcome code:
print("\t\t-----------------------------")
print("\t\t Welcome to Durva's Cafe!")
print("\t\t-----------------------------\n\n")

print("Please enter your details:\n")


name = input("Enter your name: ")
phone = int(input("Enter your phone number: "))

Main()

11
Sample Output
1. Welcome Prompt :

2. Selecting option 1, Menu :

12
3. Selecting Option 2, Order :

4. Selecting to Order option 2, Burger :

Note: Outputs are similar for Order options 3, 4 and 5 i.e., Sandwich, Pasta and Pizza
respectively.

13
5. Selecting to Order option 1, Coffee :

6. Selecting to Order Coffee option 1, Espresso :

Note: Outputs are similar for Coffee options 2, 3, 4 and 5 i.e., Cappuccino, Latte,
Americano and Mocha respectively.

14
7. Selecting option 3 in Main Prompt, Exit :

15
Conclusion
To sum up, the Cafe Management System (CMS) simplifies cafe management data
and boosts operational effectiveness, making it a crucial tool for contemporary
businesses. This system makes common cafe tasks like ordering, displaying the
menu, requesting client information, and printing the bill easier by utilizing Python
and a MySQL database.

Its intuitive interface makes it easier to use, which enhances productivity and
decision-making. As we come to the finish of this project, we see how it may
improve the management tasks that cafe attendants perform, making it an
invaluable resource for businesses.

16
Bibliography

The following references were used for this project:

A. Websites:
1. https://www.w3schools.com/python/
2. https://www.w3schools.com/python/python_mysql_getstarted.asp
3. https://pypi.org/project/mysql-connector-python/

B. Books:
1. Computer Science with Python Class - 12 by Sumita Arora
2. Computer Science with Python Class - 11 by Sumita Arora

17

You might also like