cspracticalfile
cspracticalfile
SESSION: 2024-25
COMPUTER SCIENCE
PROJECT FILE ON:
ELECTRICITY SYSTEM
INDEX
1) Certificate
2) Acknowledgement
3) About Python
4) About MYSQL
5) About the Project
6) Source Code
7) Screenshots
8) Bibliography
CERTIFICATE
Date:
Instructor’s Signature:
ACKNOWLEDGEMENT
ABOUT PYTHON
It is used for:
● web development (server-side),
● software development,
● mathematics,
● system scripting.
● Cross-Platform Compatibility:
Python runs on multiple operating systems like
Windows, macOS, and Linux, making it easy to
deploy applications across different platforms with
minimal changes.
● Large Standard Library:
Python’s extensive library provides built-in solutions
for various tasks, such as file handling, database
management, and mathematical operations, saving
time and reducing code redundancy.
● Community Support:
Python has a large, active community that offers a
wealth of resources, including tutorials, forums, and
documentation, helping to keep the language
updated and evolving.
● Readable and Simple Syntax:
Python’s simple syntax makes it beginner-friendly
and easy to read, using indentation instead of braces
to promote clean, understandable code.
ABOUT MYSQL
● High Performance:
MySQL is optimized for high-demand applications,
supporting indexing, caching, and other techniques
to deliver fast query response times with efficiency.
● Open Source:
MySQL is free to use, with an active developer
community contributing to its continuous
improvement. Its source code is publicly available,
offering flexibility and customization options.
● Cross-Platform Compatibility:
MySQL operates seamlessly across different
operating systems, including Windows, macOS, and
Linux, ensuring high portability.
Libraries Used:
● mysql.connector: Provides the connection and
interaction with MySQL database to store and
manage user and billing data.
Key Features:
User Management
● User Registration: Allows users to register their
details, including name, phone number, and bill
status.
● Account View: Users can view their own billing
details and electricity status (Active or
Disconnected).
Billing Management
● Bill Generation: Displays the due amount for each
user, based on their usage.
● Bill Payment: Provides users an option to pay their
bills, updating the status accordingly.
Admin Features
● User Monitoring: Admins can view all registered
users, check their billing status, and view which
users have outstanding payments.
● Bill Due Management: Admins can view and
manage users with overdue bills, including the ability
to disconnect electricity for non-paying users.
● Electricity Disconnection: Admins can disconnect
electricity for users with overdue bills to ensure
compliance with payment terms.
Technical Details:
● Database Management: The system uses MySQL
for managing user accounts, billing records, and
electricity status.
● Bill Tracking: Each user has a record that includes
their current bill, payment status, and electricity
connection status.
● Admin Control: Admin has full control over user
accounts, including the ability to manage overdue
bills and disconnect electricity.
● User-Focused Interface: Simple options for users
to view and pay bills, ensuring ease of use.
SOURCE CODE
import mysql.connector
def connect_to_db():
db = mysql.connector.connect(
host="localhost",
user="root",
password="password"
)
return db
def create_database_and_tables(cursor):
cursor.execute('''CREATE DATABASE IF NOT EXISTS
electricity_system;''')
cursor.execute('''USE electricity_system;''')
def admin_menu(cursor):
SCREENSHOTS
BIBLIOGRAPHY
1. https://www.w3schools.com/python/default.asp
2. https://www.w3schools.com/MySQL/default.asp
3. https://www.programiz.com/python-programming
4. https://www.geeksforgeeks.org/introduction-of-dbms-
database-management-system-set-1/