Cyber Cafe Management
Cyber Cafe Management
COLLEGE
COMPUTER SCIENCE
PROJECT
SESSION:2024-2025
1. CERTIFICATE 1
2. INTRODUCTION 2
4. PROPOSED SYSTEM 7
6. SOURCE CODE 10
7. OUTPUT SCREENS 20
9. REQUIREMENTS 24
10. BIBLIOGRAPHY 25
CERTIFICATE
DONE BY :
1.ADITYA PARMAR
2.ARYAN PAGARIA
3.KAILASH.S
DATE :
REGISTER NO :
1
Introduction
The system allows customers to register and log in, select and
use available PCs, and end their sessions with automated time
tracking. It also includes an admin interface for overseeing daily
operations, such as viewing active sessions, managing
customer records, and generating bills based on session usage.
The use of MySQL ensures secure data storage and efficient
retrieval for both customers and administrators. Overall, the
project demonstrates effective database management, session
handling, and payment processing in a real-world application
setting.
2
Features of Python :-
1. Easy :-
Python is a very easy to learn and understand; using this python tutorial,
any beginner can understand the basics of python.
2. Interpreted :-
It is interpreted (executed) line by line. This makes it easy to test and
debug.
3. Object Oriented :-
The python programming language supports classes and objects.
4. Free and Open-Source :-
The language and it‟s source code are available to the public for free;
there is no need to buy a costly license.
5. Portable :-
Since it is open source, we can run python on windows, mac, linux, or
any other platforms. Our programs will work without needing to the
changed for every machine.
6. GUI (Graphical User Interface) programming :-
We can use it to develop a GUI (Graphical User Interface). One way to
do this is through “Tkinter‟.
7. Large Library :-
Python provides us with a large standard library. We can use it to
implement a variety of functions without needing to reinvent the wheel
every time. Just pick the code we need and continue. This lets us to
focus on other important tasks.
3
Advantages of Python :-
1. Extensible :-
2. Portable
3. Free & Open-Source
4. Readable
5. Embeddable
6. Improved Productivity
7. Simple and Easy
8. Object Oriented
9. Interpreted
10. Extensive Libraries
4
About MySql :-
MySql is a fast, easy to use RDBMS (Relational Database Management
System) being used for many small and big businesses. MySql is developed,
marketed and supported by MySQL AB, which is a Swedish Company. MySql
is becoming is so popular because of many good reasons:-
5
Objective of the project
The objective of this project is to let the students apply the
programming knowledge into a real-world situation/problem and
exposed the students how programming skills help in developing
a good software.
6
Proposed System
The proposed system for the Cyber Cafe Management System aims to automate and
simplify the day-to-day operations of a cyber cafe. The system will manage customer
information, track PC usage, calculate session times, and generate billing information,
all while providing administrative functionality to oversee operations efficiently.
Key Features:
1. Customer Registration and Login:
The system allows new customers to register with their details (email, name,
phone number, and password).
Registered customers can log in and access available PCs, manage their
session timings, and receive bills based on their usage.
2. PC Session Management:
The system tracks when a customer starts and ends their PC session.
It calculates the duration of the session and automatically assigns charges
based on the time used.
3. Billing System:
After each session, the system generates a bill based on the customer’s
session time and predefined rates (e.g., rate per hour).
The system saves this bill in the database for both customer and admin
reference.
4. Admin Functionality:
Administrators can log in and view a summary of all ongoing and completed
sessions, including customer usage records.
Admins can manage customer bills, view the current status of all PCs, and end
sessions remotely if needed.
5. Database Management:
The system is integrated with a MySQL database to store customer details,
session usage records, and billing information.
It ensures data is securely stored, making retrieval efficient for both customers
and administrators.
Benefits of the Proposed System:
Automation of Manual Tasks: The system eliminates the need for manual record-
keeping, reducing human error and improving accuracy in billing and session
management.
Efficient Resource Management: By tracking the status of each PC, administrators
can ensure PCs are being used efficiently and manage peak usage times
effectively.
This proposed system ensures efficient management of cyber cafe operations,
improving both customer satisfaction and the ease of managing multiple users and
PCs.
7
Module used and their purposes
1. MySql.connector module :-
a. cursor ( ) :-
A database cursor is a useful control structure of database
connectivity. Normally when we connect to a database from within a
script/program, then the query gets sent to the server, where it gets
executed, and the set of records retrieved as per query is sent over the
connection.
b. connect ( ) :-
After we have installed Python MySql connector, we can write
python scripts using MySql.connector library that can connect to
MySql databases from within Python. Next we need to establish
connection to a MySql database using connect() function of
mysql.connector package.
<connection-object>=mysql.connector.connect(
host=<host- name>,
user=<username>,
passwd=<password>.
database=<database>)
8
- user is the username on MySql
- password is the password of the user
- host-name is the database server hostname or IP address
- database is optional which provides the database name of
a MySql database.
c. execute ( ) :-
This method is used to executes an SQL statement. Once we have
created a cursor, we can execute SQL query using execute() function
with cursor object .
For example,
If we want to view all the records of table data which is a table in the
database test to which we established connection, we can execute SQL
query “select * from data” by writing:
9
Source
Code
10
import mysql.connector
from datetime import datetime, timedelta
# Database connection
def connect_to_database():
try:
conn = mysql.connector.connect(
host="localhost",
user="root",
password="pagaria_2006",
database="cybercafe101"
)
return conn
except mysql.connector.Error as err:
print(f"Error connecting to MySQL: {err}")
return None
# Initialize database and tables
def initialize_database():
db = connect_to_database()
if not db:
print("Unable to connect to the database. Please check your MySQL connection.")
return
cursor = db.cursor()
try:
cursor.execute("CREATE DATABASE IF NOT EXISTS cybercafe101")
cursor.execute("USE cybercafe101")
cursor.execute('''
CREATE TABLE IF NOT EXISTS customers (
email VARCHAR(255) PRIMARY KEY,
name VARCHAR(255) NOT NULL,
phone VARCHAR(20) NOT NULL,
password VARCHAR(255) NOT NULL
)
''')
11
cursor.execute('''
CREATE TABLE IF NOT EXISTS usage_records (
id INT AUTO_INCREMENT PRIMARY KEY,
customer_email VARCHAR(255),
pc_id INT NOT NULL,
start_time DATETIME NOT NULL,
end_time DATETIME NOT NULL,
hours FLOAT NOT NULL,
is_active BOOLEAN DEFAULT TRUE,
FOREIGN KEY (customer_email) REFERENCES customers(email)
)
''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS bills (
id INT AUTO_INCREMENT PRIMARY KEY,
customer_email VARCHAR(255),
amount DECIMAL(10, 2) NOT NULL,
date DATE NOT NULL,
FOREIGN KEY (customer_email) REFERENCES customers(email)
)
''')
db.commit()
print("Database and tables initialized successfully.")
except mysql.connector.Error as err:
print(f"Error initializing database: {err}")
finally:
cursor.close()
db.close()
except mysql.connector.Error as err:
print(f"Error initializing database: {err}")
finally:
cursor.close()
db.close()
12
class Customer:
def __init__(self, email, name, phone):
self.email = email
self.name = name
self.phone = phone
class PC:
def __init__(self, pc_id):
self.pc_id = pc_id
self.in_use = False
self.current_user = None
self.end_time = None
def register_new(cursor):
email = input("Enter your email: ")
name = input("Enter your name: ")
phone = input("Enter your phone number: ")
while True:
password = input("Create a password: ")
confirm_password = input("Confirm your password: ")
if password == confirm_password:
break
else:
print("Passwords do not match. Please try again.")
def login_customer(cursor):
email = input("Enter your email: ")
password = input("Enter your password: ")
if result:
return Customer(result[0], result[1], result[2])
else:
print("Invalid email or password.")
return None
14
def customer_interface():
print("Welcome to the Gaming PC Cyber Cafe")
db = connect_to_database()
if not db:
print("Unable to connect to the database. Please try again later.")
return
cursor = db.cursor()
try:
while True:
choice = input("1. Login\n2. Register\n3. Exit\nEnter your choice: ")
if choice == '1':
customer = login_customer(cursor)
if customer:
break
elif choice == '2':
customer = register_new(cursor)
db.commit()
print("Registration successful! Please login.")
elif choice == '3':
return
else:
print("Invalid choice. Please try again.")
if not customer:
return
print(f"Welcome, {customer.name}!")
if active_session:
pc_id = active_session[2]
end_time = active_session[4]
print(f"You have an active session on PC {pc_id} ending at
{end_time.strftime('%H:%M:%S')}")
return
15
print("\nAvailable PCs:")
available_pcs = [pc for pc in pcs if not pc.in_use]
for pc in available_pcs:
print(f"PC {pc.pc_id}")
if not available_pcs:
print("Sorry, all PCs are currently in use. Please try again later.")
return
while True:
try:
pc_id = int(input("Enter the PC number you want to use: "))
selected_pc = next((pc for pc in available_pcs if pc.pc_id == pc_id), None)
if selected_pc:
break
else:
print("Invalid PC selection. Please choose an available PC.")
except ValueError:
print("Please enter a valid number.")
while True:
try:
hours = float(input("How many hours will you be using the PC? "))
if hours > 0:
break
else:
print("Please enter a positive number of hours.")
except ValueError:
print("Please enter a valid number.")
selected_pc.start_session(customer, hours)
start_time = datetime.now()
end_time = start_time + timedelta(hours=hours)
cursor.execute("""
INSERT INTO usage_records
(customer_email, pc_id, start_time, end_time, hours, is_active)
VALUES (%s, %s, %s, %s, %s, TRUE)
""", (customer.email, pc_id, start_time, end_time, hours))
db.commit()
16
rate_per_hour = 100
bill_amount = customer.calculate_bill(hours, rate_per_hour)
print(f"Your bill amount is: ₹{bill_amount:.2f}")
def admin_interface():
print("Admin Interface")
password = input("Enter admin password: ")
if password != "admin123":
print("Invalid password")
return
db = connect_to_database()
if not db:
print("Unable to connect to the database. Please try again later.")
return
cursor = db.cursor(dictionary=True)
try:
while True:
print("\n1. View all usage records")
print("2. View customer bills")
print("3. View current PC status")
print("4. End a PC session")
print("5. Exit")
choice = input("Enter your choice: ")
17
if choice == "1":
cursor.execute("SELECT * FROM usage_records")
records = cursor.fetchall()
for record in records:
print(record)
elif choice == "2":
cursor.execute("SELECT * FROM bills")
bills = cursor.fetchall()
for bill in bills:
print(bill)
elif choice == "3":
for pc in pcs:
status = "In use" if pc.in_use else "Available"
user = pc.current_user.email if pc.current_user else "N/A"
end_time = pc.end_time.strftime('%H:%M:%S') if pc.end_time else "N/A"
print(f"PC {pc.pc_id}: {status}, User: {user}, End Time: {end_time}")
elif choice == "4":
pc_id = int(input("Enter the PC number to end session: "))
pc_to_end = next((pc for pc in pcs if pc.pc_id == pc_id), None)
if pc_to_end and pc_to_end.in_use:
pc_to_end.end_session(db)
else:
print("Invalid PC number or PC is not in use.")
elif choice == "5":
break
else:
print("Invalid choice")
except mysql.connector.Error as err:
print(f"An error occurred: {err}")
finally:
cursor.close()
db.close()
18
def main_loop():
initialize_database()
while True:
print("\n1. Customer Login/Register")
print("2. Admin Login")
print("3. Exit")
choice = input("Enter your choice: ")
if choice == "1":
customer_interface()
elif choice == "2":
admin_interface()
elif choice == "3":
break
else:
print("Invalid choice")
if __name__ == "__main__":
main_loop()
19
Output
Screens
20
1.Registering a new account:-
21
3.Admin login and to view all usage records
22
7.Mysql output:
Limitations and Future Scope
Limitations :-
Only one player can register at a time.
user can use the pc till the specific time
It does provide timing system.
Future Scope :-
23
Requirements
Hardware required :-
Software required :-
24
Bibliography
1. www.google.com
2. www.youtube.com
2. Computer Science with Python
by Sumita Arora Class XII(Book)
25
Thank You!!
26