0% found this document useful (0 votes)
6 views33 pages

New Green Field School

Uploaded by

riyachuahan0
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)
6 views33 pages

New Green Field School

Uploaded by

riyachuahan0
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/ 33

NEW GREEN FIELD SCHOOL

Informatics Practices
Project on

Electricity Bill System

Made By – Soham Choudhary


Class – XII-F (Commerce)
Roll No. - 14
Academic Year – 2025-26
CONTENT

❖ ACKNOWLEDGMENT
❖ CERTIFICATE
❖ PREFACE
❖ MODULES USED
❖ METHODOLOGY / SYNOPSIS
❖ CODING
❖ OUTPUT
❖ BIBLIOGRAPHY
ACKNOWLDEGEMENT

I am very grateful to our Informatics Practices teacher, Ms.


Sucheta, whose remarkable support helped in completing my
project. This project might have not been possible without his
guidance and teachings. With all due regards, I owe a sincere
thanks to all those friends without whose feedbacks this project
would not have been such a great success.

It is a pleasure to acknowledge the superb guidance and help


extended by my teacher. I would also like to thank our respected
principal ma’am, to provide such faculty and other facilities
without which this project wouldn’t have been possible.

SOHAM CHOUDHARY
XII-F
COMMERCE
CERTIFICATE

It is hereby certified that Soham


Choudhary has worked on this
project under my guidance. It is up to
my expectations and required
standard of the school. The project
includes all the class XII CBSE
Informatics Practices requirements.

Ms. Sucheta
(Informatics Practices)
PREFACE

This project lays the foundation of the topic


taught to us. I have covered all the topics in
elaborative and in simple language that can
be easily understood by the programmer. I
have worked my best to keep the
presentation of the program short, simple
program, one can enjoy by running the
program.
METHODOLOGY /
SYNOPSIS

Project Name – Electricity Bill System

Software Requirements –

❖ Windows OS (Win 7 or above)


❖ Python (Front – End Application)
❖ CSV File (Back – End Application)
CSV FILES –

❖ Customer – To store customer details

❖ Bill – To store customer’s bill


CODING
Python Coding
import pandas as pd
import matplotlib.pyplot as plt
import os

# File paths
customer_file = 'customer.csv'
bill_file = 'bill.csv'

# Fields
customer_fields = ['cust_id', 'name', 'address', 'phone', 'units',
'category']
bill_fields = ['cust_id', 'base_rate', 'fixed_charge', 'tax_percent',
'other_charge', 'total_bill']

# data
customers = [
['C101', 'Soham', 'Delhi', '99716023227', 230, 'Domestic'],
['C102', 'Anjali Mehra', 'Mumbai', '9123456789', 180,
'Commercial'],
['C103', 'Sameer Khan', 'Hyderabad', '9012345678', 120,
'Domestic'],
['C104', 'Priya Sharma', 'Chennai', '9988776655', 300,
'Industrial'],
['C105', 'Aman Verma', 'Kolkata', '9871234567', 150,
'Domestic'],
['C106','Rajesh','Uttar Pradesh','9871234535 ',120,'Domestic']
]

bills = []

for cust in customers:


units = cust[4]
category = cust[5]

if category == 'Domestic':
rate = 7
tax = 5
fixed = 50
other = 30
elif category == 'Commercial':
rate = 9
tax = 12
fixed = 100
other = 50
else:
rate = 11
tax = 18
fixed = 200
other = 75

base = units * rate


total = base + fixed + other + (base * tax / 100)
bills.append([cust[0], base, fixed, tax, other, round(total, 2)])

# Initialize CSV files


def init_files():
if not os.path.exists(customer_file):
pd.DataFrame(customers,
columns=customer_fields).to_csv(customer_file, index=False)
if not os.path.exists(bill_file):
pd.DataFrame(bills, columns=bill_fields).to_csv(bill_file,
index=False)
# Add Customer
def add_customer():
df = pd.read_csv(customer_file)
bdf = pd.read_csv(bill_file)

cust_id = input("Customer ID: ")


name = input("Name: ")
address = input("Address: ")
phone = input("Phone: ")
units = int(input("Units Consumed: "))
category = input("Category (Domestic/Commercial/Industrial):
")

if cust_id in df['cust_id'].values:

print("❌ Customer already exists.")


return

df.loc[len(df)] = [cust_id, name, address, phone, units, category]

# Billing
if category == 'Domestic':
rate = 7
tax = 5
fixed = 50
other = 30
elif category == 'Commercial':
rate = 9
tax = 12
fixed = 100
other = 50
else:
rate = 11
tax = 18
fixed = 200
other = 75

base = units * rate


total = base + fixed + other + (base * tax / 100)

bdf.loc[len(bdf)] = [cust_id, base, fixed, tax, other, round(total,


2)]
df.to_csv(customer_file, index=False)
bdf.to_csv(bill_file, index=False)

print("✅ Customer and bill added successfully.")

# Update Customer
def update_customer():
df = pd.read_csv(customer_file)
bdf = pd.read_csv(bill_file)

cust_id = input("Enter Customer ID to update: ")


idx = df[df['cust_id'] == cust_id].index

if idx.empty:

print("❌ Customer not found.")


return

name = input("Name: ")


address = input("Address: ")
phone = input("Phone: ")
units = int(input("Units Consumed: "))
category = input("Category (Domestic/Commercial/Industrial):
")

df.loc[idx[0]] = [cust_id, name, address, phone, units, category]

if category == 'Domestic':
rate = 7
tax = 5
fixed = 50
other = 30
elif category == 'Commercial':
rate = 9
tax = 12
fixed = 100
other = 50
else:
rate = 11
tax = 18
fixed = 200
other = 75
base = units * rate
total = base + fixed + other + (base * tax / 100)

bdf.loc[bdf['cust_id'] == cust_id] = [cust_id, base, fixed, tax,


other, round(total, 2)]

df.to_csv(customer_file, index=False)
bdf.to_csv(bill_file, index=False)

print("✅ Customer and bill updated.")

# Delete Customer
def delete_customer():
df = pd.read_csv(customer_file)
bdf = pd.read_csv(bill_file)

cust_id = input("Enter Customer ID to delete: ")

if cust_id in df['cust_id'].values:
df = df[df['cust_id'] != cust_id]
bdf = bdf[bdf['cust_id'] != cust_id]
df.to_csv(customer_file, index=False)
bdf.to_csv(bill_file, index=False)

print("✅ Customer deleted.")


else:

print("❌ Customer not found.")

# View Customer Records


def view_customers():
df = pd.read_csv(customer_file)
while True:
print("\n--- View Customer Records ---")
print("1. View Top 5 Records")
print("2. View Bottom 5 Records")
print("3. View Specific Customer Details")
print("4. Return to Main Menu")
sub = input("Enter your choice: ")

if sub == '1':

print("\n📄 Top 5 Customer Records:\n")


print(df.head(5))

elif sub == '2':


print("\n📄 Bottom 5 Customer Records:\n")
print(df.tail(5))

elif sub == '3':


cust_id = input("Enter Customer ID to view: ")
record = df[df['cust_id'] == cust_id]
if not record.empty:

print(f"\n🔍 Details of Customer ID {cust_id}:\n")


print(record)
else:

print("❌ Customer not found.")

elif sub == '4':


break
else:
print("Invalid sub-choice. Try again.")# View Bill
def view_bill():
bdf = pd.read_csv(bill_file)
cust_id = input("Enter Customer ID to view bill: ")
if cust_id in bdf['cust_id'].values:
print(bdf[bdf['cust_id'] == cust_id])
else:

print("❌ Bill not found.")

# Statistics
def statistics():
df = pd.read_csv(customer_file)
print("Columns:", df.columns.tolist())
print("Shape:", df.shape)
print("Data Types:\n", df.dtypes)
print("Summary:\n", df.describe())

# Data Visualization
def visualize():
df = pd.read_csv(customer_file)
plt.bar(df['cust_id'], df['units'], color='green')
plt.xlabel("Customer ID")
plt.ylabel("Units Consumed")
plt.title("Electricity Usage per Customer")
plt.show()

# Menu
def menu():
init_files()
while True:
print("\n====== Electricity Bill System ======")
print("1. Add Customer")
print("2. Update Customer")
print("3. Delete Customer")
print("4. View All Customers")
print("5. View Bill")
print("6. View Statistics")
print("7. Data Visualization")
print("8. Exit")

ch = input("Enter your choice: ")


if ch == '1':
add_customer()
elif ch == '2':
update_customer()
elif ch == '3':
delete_customer()
elif ch == '4':
view_customers()
elif ch == '5':
view_bill()
elif ch == '6':
statistics()
elif ch == '7':
visualize()
elif ch == '8':
print("Exiting. Thank you!")
break
else:
print("Invalid choice.")

# Run
menu()
OUTPUT
Main Screen

Add Customer
Update Customer

Delete Customer
View Customer

View Bill
View Statistics
Data Visualization
View Top 5 Customers
View Bottom 5 Customers
Details of Specific Customer
Return to Main Menu
BIBLIOGRAPHY

❖ Informatics Practices by Sumita


Arora for Class XII.

❖ Informatics Practices For Class XII by


Preeti Arora

❖ https://www.google.com/

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy