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

Computer Science Project SESSION: 2024-2025: Don Bosco H.S School, Kokrajhar

Uploaded by

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

Computer Science Project SESSION: 2024-2025: Don Bosco H.S School, Kokrajhar

Uploaded by

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

COMPUTER SCIENCE

PROJECT

SESSION: 2024-2025

DON BOSCO H.S SCHOOL, KOKRAJHAR

Submitted by:
Name: Karanjit Brahma
Roll no: 16
Class: XII (Science)
Subject: Computer science
Subject Teacher: Mam Sarojini Basumatary
ACKNOWLEDGMENT
I would like to express my sincere gratitude to
Sarojini Mam, my Computer Science teacher, for
their guidance and support throughout the
development of this project. I would also like to
thank my friends and family for their encouragement
and support.
CERTIFICATE
This certifies that Karanjit Brahma, a dedicated student of Class 12,
has successfully completed the "Weather Forecast Application"
project during the academic year 2023-2024. This project was
undertaken as a part of the curriculum under the meticulous
guidance and supervision of Sarojini Mam.

Karanjit's project involved designing and developing a


sophisticated Weather Forecast Application that provides users
with real-time weather information for any city worldwide. The
application utilises the OpenWeatherMap API to retrieve current
weather data, including temperature, humidity, wind speed, and
general weather conditions. Additionally, the project showcased
Karanjit's ability to integrate Python programming with a MySQL
database, efficiently storing the user's search history and
demonstrating the practical application of databases and external
APIs in real-world scenarios.

Throughout the development of this project, Karanjit has exhibited


exemplary skills in programming, problem-solving, and data
management. His commitment to excellence and attention to detail
have resulted in a robust and user-friendly application, reflecting
his proficiency and dedication to his studies.

We extend our heartfelt congratulations to Karanjit Brahma for his


outstanding work and wish him continued success in all his future
endeavours

Signature of Student: ________________


Signature of Teacher: ________________
Date: ________________
CONTENT
1. Introduction
2. Life Cycle of Software
○ Planning
○ Analysis
○ Design
○ Implementation
○ Testing
○ Maintenance
3. Project Details
○ Database Design
○ Application Code
4. Output
5. Conclusion
INTRODUCTION
The Weather Forecast Application is
designed to provide users with up-to-date
weather information for any city across the
globe. By leveraging the OpenWeatherMap
API, the application fetches real-time
weather data, including key metrics such
as temperature, humidity, wind speed, and
overall weather conditions. This project
exemplifies the practical integration of
Python with a MySQL database, which
stores the user's search history. This
combination showcases the effective use
of databases and external APIs in a
real-world application, offering users a
seamless and informative weather
forecasting experience. The application's
architecture ensures efficient data retrieval
and storage, making it a robust tool for
daily weather updates and historical data
analysis.
Life Cycle of Software Development

1. Planning
The planning phase is crucial as it sets
the foundation for the entire project. The
main objective was to create a robust
application capable of fetching and
displaying real-time weather information
for a given city. To enhance user
experience and functionality, the idea was
to integrate a database that would store
the user's search history. This phase
involved brainstorming sessions to outline
the project's scope, goals, and timeline.
Additionally, resource allocation, risk
management strategies, and preliminary
budget considerations were addressed to
ensure the project's feasibility and
alignment with user needs.

2. Analysis
During the analysis phase, detailed
requirements for the application were
gathered and analysed. This involved
understanding user needs and translating
them into specific, actionable
requirements. Key requirements identified
were:
- A graphical user interface (GUI) for
user-friendly interaction.
- Integration with the OpenWeatherMap
API to fetch real-time weather data.
- A MySQL database to store and
manage the search history of users.
This phase also included feasibility
studies, requirement validation, and
creating a requirement specification
document to guide the design and
development process.

3. Design
The design phase focused on creating a
blueprint for the application. This involved:
- Developing a database schema to
define the structure of the search history
table.
- Planning the user interface to ensure it
is intuitive and easy to use.
- Designing the interaction between
different components of the application.
- Creating wireframes and mockups for
the GUI to visualise the end product.
The design also addressed performance
considerations, ensuring the application
could handle multiple users and large
amounts of data efficiently.

4. Implementation
In the implementation phase, the actual
coding of the application took place. The
project was developed using Python, with
the Tkinter library employed for the GUI
and mysql-connector-python for database
connectivity. Key steps included:
- Setting up the development
environment.
- Writing and testing individual modules.
- Integrating the modules to form a
cohesive application.
- Implementing error handling and user
input validation to enhance robustness.
- Conducting initial testing to identify
and fix bugs early in the development
process.

5. Testing
The testing phase ensured the
application was functional, reliable, and
met the specified requirements. Various
testing methods were employed:
- Unit testing to verify the functionality of
individual components.
- Integration testing to ensure different
modules worked seamlessly together.
- System testing to validate the
application as a whole.
- User acceptance testing (UAT) to gather
feedback from potential users.
- Performance testing to ensure the
application could handle concurrent users
and large datasets without significant
delays.
6. Maintenance
The maintenance phase involves
ongoing support and updates to the
application post-deployment. This
includes:
- Monitoring the application for any
issues or bugs reported by users.
- Releasing patches and updates to fix
bugs and improve performance.
- Enhancing the application based on
user feedback and evolving requirements,
such as adding new features like multi-day
weather forecasts.
- Ensuring compatibility with API
updates from OpenWeatherMap and other
third-party services.
- Regularly updating the database
schema and optimising queries to
maintain performance and scalability.

Expanded Process Overview


The entire software development life cycle
(SDLC) was meticulously followed to
ensure the successful completion of the
Weather Forecast Application. Each phase
was carefully executed, with continuous
evaluation and improvements to meet the
high standards set at the project's
inception. By integrating modern
technologies and adhering to best
practices in software development, the
project not only achieved its initial goals
but also laid a strong foundation for future
enhancements and scalability.

Project Details
Database Design
sql
CREATE DATABASE weather_forecast;

USE weather_forecast;

CREATE TABLE search_history (


id INT AUTO_INCREMENT PRIMARY KEY,
city VARCHAR(255) NOT NULL,
weather VARCHAR(255) NOT NULL,
temperature FLOAT NOT NULL,
humidity INT NOT NULL,
wind_speed FLOAT NOT NULL,
search_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
weather_app.py
python
import tkinter as tk
from tkinter import messagebox
import requests
import mysql.connector

# Constants
API_KEY = "your_openweathermap_api_key"
BASE_URL = "http://api.openweathermap.org/data/2.5/weather"

# Database connection
conn = mysql.connector.connect(
host="localhost",
user="root",
password="your_mysql_password",
database="weather_forecast"
)
c = conn.cursor()

def save_search_history(city, weather, temperature, humidity,


wind_speed):
c.execute(
"INSERT INTO search_history (city, weather,
temperature, humidity, wind_speed) VALUES (%s, %s, %s, %s,
%s)",
(city, weather, temperature, humidity, wind_speed)
)
conn.commit()

class WeatherApp:
def __init__(self, root):
self.root = root
self.root.title("Weather Forecast Application")
self.create_widgets()
def create_widgets(self):
self.frame = tk.Frame(self.root)
self.frame.pack(padx=10, pady=10)

self.lbl_city = tk.Label(self.frame, text="City:")


self.lbl_city.grid(row=0, column=0, padx=5, pady=5)
self.entry_city = tk.Entry(self.frame)
self.entry_city.grid(row=0, column=1, padx=5, pady=5)

self.btn_get_weather = tk.Button(self.frame, text="Get


Weather", command=self.get_weather)
self.btn_get_weather.grid(row=1, column=0,
columnspan=2, padx=5, pady=5)

self.lbl_weather = tk.Label(self.frame, text="")


self.lbl_weather.grid(row=2, column=0, columnspan=2,
padx=5, pady=5)

def get_weather(self):
city = self.entry_city.get()
if not city:
message box.show error("Error", "Please enter a
city name")
return

params = {
"q": city,
"appid": API_KEY,
"units": "metric"
}

response = requests.get(BASE_URL, params=params)


if response.status_code == 200:
data = response.json()
weather = data['weather'][0]['description']
temperature = data['main']['temp']
humidity = data['main']['humidity']
wind_speed = data['wind']['speed']
self.lbl_weather.config(
text=f"Weather: {weather}\nTemperature:
{temperature}°C\nHumidity: {humidity}%\nWind Speed:
{wind_speed} m/s"
)
save_search_history(city, weather, temperature,
humidity, wind_speed)
else:
messagebox.showerror("Error", "City not found!")

def main():
root = tk.Tk()
app = WeatherApp(root)
root.mainloop()

if __name__ == "__main__":
main()

You might also like