0% found this document useful (0 votes)
3 views

cspracticalfile

Uploaded by

sumrawat07
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

cspracticalfile

Uploaded by

sumrawat07
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

DELHI PUBLIC SCHOOL RANIPUR

SESSION: 2024-25
COMPUTER SCIENCE
PROJECT FILE ON:
ELECTRICITY SYSTEM

SUBMITTED TO: SUBMITTED BY:


Mr. NADEEM SUMIT SINGH RAWAT CHIRAG SINGHANIA
(CS DEPARTMENT) 2011/ 0073 XII-F 2011/0116 XII-F
ROLL NO. 13 ROLL NO. 19

INDEX
1) Certificate
2) Acknowledgement
3) About Python
4) About MYSQL
5) About the Project
6) Source Code
7) Screenshots
8) Bibliography

CERTIFICATE

This is to certify that ___ and ___ have successfully


completed their project work titled “Electricity System.”

This project was undertaken as part of the curriculum for


the Computer Science course under the mentorship of Mr.
Nadeem. It involved the practical application of various
software development principles, including Python
programming and database integration. The primary goal
was to design and implement a comprehensive system
for managing electricity supply and bill payments.

Completed during the academic year 2024-25, this


project showcased the students' ability to analyze,
design, and develop a functional software solution. It also
emphasized the significance of modular programming,
effective error handling, and creating a user-friendly
interface.

Date:
Instructor’s Signature:
ACKNOWLEDGEMENT

We would like to extend our heartfelt gratitude to


everyone who contributed to the successful completion of
our project, "Electricity System."

Firstly, we are profoundly thankful to Mr. Nadeem, our


mentor, for his constant support, insightful guidance, and
invaluable feedback throughout the project. His expertise
played a significant role in helping us overcome
challenges and refine our work to meet high standards.

We also express our sincere thanks to DPS Ranipur and


the Computer Science Department for providing us with
the opportunity and resources to undertake this project.
The supportive learning environment allowed us to
explore and apply various programming and project
development concepts.

Finally, we are deeply appreciative of our friends and


family for their encouragement, patience, and support,
which made this journey possible.

ABOUT PYTHON

Python is an interpreted, object-oriented, high-level


programming language with dynamic semantics. Its high-
level built in data structures, combined with dynamic
typing and dynamic binding, make it very attractive for
Rapid Application Development, as well as for use as a
scripting or glue language to connect existing
components together. Python's simple, easy to learn
syntax emphasizes readability and therefore reduces the
cost of program maintenance. Python supports modules
and packages, which encourages program modularity and
code reuse. The Python interpreter and the extensive
standard library are available in source or binary form
without charge for all major platforms, and can be freely
distributed.

It is used for:
● web development (server-side),
● software development,
● mathematics,
● system scripting.

Key Points About Python:

● 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

MySQL is a relational database management system


(RDBMS) developed by Oracle that is based on structured
query language (SQL).

A database is a structured collection of data. It may be


anything from a simple shopping list to a picture gallery
or a place to hold the vast amounts of information in a
corporate network. In particular, a relational database is a
digital store collecting data and organizing it according to
the relational model. In this model, tables consist of rows
and columns, and relationships between data elements
all follow a strict logical structure. An RDBMS is simply the
set of software tools used to actually implement, manage,
and query such a database.

Key Features of 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.

● Extensive Documentation and Support:


MySQL provides comprehensive documentation,
along with support from both the MySQL community
and professional services offered by Oracle.

ABOUT THE PROJECT


This project is a Python-based Electricity System
designed to manage user accounts, billing, and electricity
status. It leverages MySQL as the database to handle the
storage and management of user data, electricity bills,
and system operations such as disconnecting electricity
for users with overdue bills.

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.

Payment and Disconnection Process


● Electricity Cutoff: Admins have the ability to
disconnect electricity for users who haven't paid their
bill on time, with the option to reconnect once the
payment is made.
● Automatic Updates: Upon bill payment, the system
updates the user's status and reactivates electricity
services.

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.

This system helps in efficiently managing electricity


services, ensuring timely payments, and streamlining the
operations of electricity providers.

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;''')

cursor.execute('''DROP TABLE IF EXISTS Users;''')

cursor.execute('''CREATE TABLE Users (


user_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
phone VARCHAR(15),
bill_due FLOAT DEFAULT 0.0,
electricity_status ENUM('Active', 'Disconnected')
DEFAULT 'Active'
);
''')

cursor.execute('''INSERT INTO Users (name, phone,


bill_due, electricity_status)
VALUES
('Sumit', '7345820419', 50.00, 'Active'),
('Chirag', '9876543210', 0.00, 'Active'),
('Ishaan', '6823547702', 75.00, 'Active'),
('Ram', '7983745562', 100.00, 'Active');''')

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/

You might also like