CS FWMS Project by Aryan
CS FWMS Project by Aryan
Submitted By:
NAME- Aryan Beniwal
CLASS- XII-C3
CBSE ROLL NO- 14610292
SUBJECT-Computer Science
SESSION-2024-25
ACKNOWLEDGEMENT
I extend my sincere gra tude to our school management for their unwavering
encouragement and provision of all necessary facili es for this project. Their
magnanimity is deeply appreciated.
Aryan Beniwal
CERTIFICATE
This is to cer fy that this project report “Aryan Beniwal” is the bona de
14610292 of class XII for the year 2024-25. He has carried out the project
● INTRODUCTION
● FUNCTIONS USED
● TABLES IN DATABASE
● SOURCE CODE
● OUTPUT SCREENSHOTS
● BIBLIOGRAPHY
INTRODUCTION
1. Introduction to Food Waste
• De nition of Food Waste: Food waste occurs throughout the food supply
chain, from production to consumption. It refers to discarded food.
• Global and Local Impact: Discusses the global scale of food waste,
including its environmental impact, such as carbon emissions and
resource waste.
6. Case Studies
9. Conclusion
1. View all food items and their associated waste: This query
will display all records from the food_waste table:
2. View the total food waste: This query will calculate the total
waste from all food items:
3. View food waste data with food item count: If you want to see
the total waste per food item, you can group the results by the
food item:
SOURCE CODE
import mysql.connector
class FoodWasteManagement:
def __init__(self):
"""Initialize the connection to the MySQL database."""
self.db = mysql.connector.connect(
host="localhost", # Replace with your host
user="root", # Replace with your MySQL username
password="", # Replace with your MySQL password
database="food_waste_db" # Replace with your database name)
self.cursor = self.db.cursor()
if not result:
print("No food waste data available.")
else:
print("Food Waste Report:")
for food, waste in result:
print(f"- {food}: {waste} kg wasted")
def get_total_waste(self):
"""Calculate and display the total food waste from the database."""
query = "SELECT SUM(amount_wasted) FROM food_waste"
self.cursor.execute(query)
total_waste = self.cursor.fetchone()[0]
print(f"Total food waste: {total_waste} kg")
def close_connection(self):
"""Close the database connection."""
self.cursor.close()
self.db.close()
if choice == 1:
name = input("Enter food item name: ")
amount = oat(input("Enter the amount of food wasted (kg): "))
system.add_food_item(name, amount)
elif choice == 2:
system.view_waste_report()
elif choice == 3:
system.get_total_waste()
elif choice == 4:
print("Exiting system.")
system.close_connection() # Ensure closing the database connection
break
else:
print("Invalid choice. Please try again.")
except ValueError:
print("Invalid input. Please enter a valid option.")
OUTPUT SCREENSHOT
BIBLIOGRAPHY
● www.geeksforgeeks.org
● https://www.google.co.in/
THANK YOU