Ip Project
Ip Project
E
2024-2025
CLASS XII
INFORMATICS PRACTICES
(065)
PROJECT FILE
ROLL NUMBER:
CERTIFICATION
HARDWARE REQUIREMENTS
A Computer/laptop with Operating System Windows 7
or above x86 64-bit CPU (Intel/AMD architecture) 2GB
RAM.
SOFTWARE REQUIREMENTS
Operating system- Windows 10
Platform- Python IDLE 3.8.3
Database- CSV File
Language- Python
PYTHON REQUIREMENTS
Library: Pandas
Module: matplotlib.pyplot
CODE
import csv # importing csv
import matplotlib.pyplot as plt # importing
matplotlib
import os # For checking if files exist
if not os.path.exists(PRODUCTS_FILE):
with open(PRODUCTS_FILE, 'w', newline='') as
file:
writer = csv.writer(file)
writer.writerow(['ProductID', 'Name', 'Price'])
if not os.path.exists(SALES_FILE):
with open(SALES_FILE, 'w', newline='') as file:
writer = csv.writer(file)
writer.writerow(['BillID', 'ProductID',
'ProductName', 'Quantity', 'Price'])
def add_product(): # Add a new product
while True:
view_products()
product_id = input("Enter Product ID to add to
bill (or type 'x' to finish): ")
if product_id.lower() == 'x':
break
try:
quantity = int(input("Enter Quantity: "))
except ValueError:
print("Invalid input for quantity. Please enter
an integer.")
continue
else:
print("Product not found. Please try
again.")
if products:
plt.figure(figsize=(10, 6))
plt.bar(products.keys(), products.values(),
coluor='purple', width=0.5)
plt.xlabel('Products')
plt.ylabel('Total Sales')
plt.title('Sales Report')
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()
else:
print("No sales data available to visualize.")
def main(): # Main function
initialize_files()
while True:
print("\nBilling Software Menu:")
print("1. Add Product")
print("2. View Products")
print("3. Create Bill")
print("4. Visualize Sales")
print("5. Exit")
if choice == '1':
add_product()
elif choice == '2':
view_products()
elif choice == '3':
create_bill()
elif choice == '4':
sales_report()
elif choice == '5':
print("Exiting the software.")
break
else:
print("Invalid choice. Please try again.")
Websites referred:
www.pythonbasics.org
www.w3schools.com