AJP REPORT2
AJP REPORT2
MICRO-PROJECT REPORT
Submitted By:
SOHAM VILAYATKAR
Enrollment No. 2200240175
`
VISION:
To educate students, to be computer technology expert & technocrat, with brainstorming and
learning hardware, software, cocurricular and extracurricular concept.
MISSION:
To enhance and pacify knowledge thirst in order to strengthen IT and Computer skills
in building blocks of Nation.
1|Page
DEPARTMENT OF COMPUTER ENGINEERING
DR. PANJABRAO DESHMUKH POLYTECHNIC, AMRAVATI
(A Govt Aided Institute)
CERTIFICATE
This is to certificate that the Mr. Soham Vilayatkar. Roll No 47 of Fifth Semester of Diploma in
Computer Engineering has completed the Project entitled ‘Weather App' satisfactorily in the
partial fulfilment of Project for the academic year 2024-25 as prescribed in the curriculum.
Guide by
Prof S.S.Patil HOD Principal
Prof.R.H.Rathod Dr.G.R.Gosavi
2|Page
ACKNOWLEDGEMENT
First, we would like to thank all the people that worked along with us with their patience and
openness they created an enjoyable working environment.
It is indeed with a great sense of pleasure and immense sense of gratitude that we acknowledge the
help of these individuals.
We would like to thank my Head of the Department for his constructive criticism throughout our
Microproject.
Nextly, We would like to thank my project guide Prof.S.S.Patil for his guidance throughout the
project.
We’re extremely grateful to our department staff members and friends who helped us in successful
completion of this project.
3|Page
STUDENT DETAILS
Title of the Micro-Project: “Weather App” Submitted By:
1.
Soham .P. Vilayatkar 47
Teacher’s Signature
4|Page
INDEX
1. Aim 06
2. Benefits 06
3. Course Outcomes 06
4. Introduction 07
5. Project Overview 09
Technologies Used 11
7.
8. Functional Requirement 13
9 ER Diagram 16
11 Flowchart 18
14 Conclusion 35
15 References 35
5|Page
1. Aim
Weather App.
2. Benefits
1. Real-time Updates: Provides accurate and instant weather information.
2. Dual Input Options: Users can search by city name or geographic coordinates.
3. User-Friendly Interface: Simple and intuitive design for easy interaction.
4. Practical Usage: Helps users plan activities based on current weather conditions.
5. Scalability: Can be enhanced with additional features like forecasts or graphical data.
6. API Integration Skills: Demonstrates the ability to integrate and utilize external APIs.
7. Learning Opportunity: Enhances understanding of Java Swing and JSON parsing.
8. Reusable Code: Can serve as a foundation for other Java-based API projects.
3. Course Outcomes
1. Develop programming using GUI Framework (AWT and Swing).
2. Handle events of AWT and Swings components.
3. Develop Java program using network concepts.
4. Develop program using database.
5. Develop program using servlet.
6|Page
4. Introduction
The Weather Application is a desktop-based program developed using Java Swing, designed to
provide real-time weather updates in a user-friendly interface. By leveraging the OpenWeather API,
the application fetches accurate weather information based on user inputs, offering two methods of
retrieval: city name or geographic coordinates (latitude and longitude). With its intuitive design, the
app displays essential weather details such as temperature, humidity, wind speed, and current
weather conditions. This project combines the power of API integration with robust Java
programming to deliver a practical tool for users seeking reliable and instant weather updates..
City Name: By entering the name of a city, the app fetches the weather details specific to that city.
Latitude and Longitude: Users can input geographic coordinates to receive weather information
for a precise location. This feature is particularly useful for remote areas or when users want more
specific weather details based on geographic positioning.
3. User-Friendly GUI:
The app’s graphical user interface (GUI) is built using Java Swing, offering a simple and intuitive
layout. The design includes text fields for input, buttons for interaction, and labels to display results. It
provides a smooth user experience, making it easy for anyone, even without technical expertise, to use
the application effectively.
4. Detailed Weather Information:
Upon fetching data, the app displays important weather metrics, including:
5. Error Handling:
The app includes robust error handling to ensure a seamless user experience. If the user enters invalid
data (e.g., a misspelled city name or incorrect coordinates), the app provides clear error messages.
Additionally, it handles issues like network problems or incorrect API responses, ensuring that the
application remains functional even in case of minor errors.
7|Page
6. Compact Design:
The application is designed to be lightweight and efficient. The user interface is kept simple, and the
program is optimized for fast performance. This ensures that the app runs smoothly on most systems,
without consuming excessive resources, making it an accessible tool for users with varying system
capabilities.
7. Reusable Components:
The app’s modular design and clean code structure make it easy to extend or repurpose. The weather-
fetching logic and the GUI components can be reused in future projects or enhanced with additional
features such as long-term weather forecasts, graphical weather charts, or alerts for extreme weather
conditions.
8. Lightweight Application:
As a desktop application built using Java, the weather app is designed to be lightweight and does not
require much memory or processing power. It can run efficiently on systems with lower
specifications, ensuring that users don’t need high-end hardware to access and use the app. This
makes the application suitable for a wide range of devices, from personal computers to lower-end
laptops.
8|Page
5. Project Overview
Purpose of the Project
The purpose of the Weather Application project is to create a user-friendly and efficient desktop
solution for retrieving real-time weather updates. With the growing need for accurate weather
information in daily life, this application aims to provide users with essential weather details such as
temperature, humidity, wind speed, and conditions in a quick and accessible manner. By leveraging
the OpenWeather API, the project showcases the integration of external APIs into Java-based
applications, enhancing its functionality and reliability. It serves as a practical tool for users to plan
activities, travel, or make decisions based on current weather conditions. Additionally, the project
provides an excellent opportunity to deepen knowledge of Java Swing, JSON parsing, and API
usage while fostering a deeper understanding of software design and user interface development..
9|Page
6. Objective of the Weather App
The primary objective of the Weather Application is to develop a desktop-based solution that provides
users with real-time weather updates in a convenient and accessible manner. The project focuses on the
following detailed objectives:
By meeting these objectives, the project not only solves a real-world problem but also acts as a
comprehensive demonstration of software development skills, making it a valuable contribution to both users
and developers.
10 | P a g
e
7. Technologies Used
1. Java:
o Core Language: The application is developed using Java, a versatile and widely-used
programming language known for its platform independence and object-oriented features.
o Key Usage: Java provides the logic for fetching and processing weather data, implementing
error handling, managing database interactions, and handling user inputs and outputs.
2. Java Swing:
o Graphical User Interface (GUI): Swing is utilized to create the user-friendly interface for the
application.
o Key Components: Text fields for user input (city name or coordinates), buttons for triggering
weather retrieval, and labels for displaying weather details such as temperature, humidity, and
wind speed.
3. MySQL:
o Database Management System: MySQL is used to store and manage historical weather data
fetched by the application.
o Key Usage:
Storing user search queries (e.g., city names, coordinates).
Archiving weather information for future reference.
Enabling data retrieval for analysis or trend visualization.
o Integration: The application connects to the MySQL database using JDBC (Java Database
Connectivity) to perform operations like insertion, retrieval, and deletion of records.
4. OpenWeather API:
o API Integration: The application integrates with the OpenWeather API to fetch real-time
weather data based on the user's input.
o Key Features: Provides data such as current temperature, weather conditions, wind speed, and
humidity. The API is accessed using an HTTP request, and the response is parsed in the
application.
5. JSON Parsing:
o Data Handling: The weather data fetched from the OpenWeather API is in JSON format. Java
libraries, such as org.json or Jackson, are used to parse the JSON response and extract
relevant information.
o Key Usage: Extracting data fields like temperature, weather description, wind speed, and
humidity for display and storing it in the database.
6. HTTP Client Libraries:
o Networking: Libraries such as HttpURLConnection or third-party libraries like Apache
HttpClient are used to make HTTP GET requests to the OpenWeather API.
o Key Usage: Establishing a connection with the API, sending requests, and retrieving weather
data efficiently.
7. Integrated Development Environment (IDE):
o Development Tools: IDEs like IntelliJ IDEA, Eclipse, or NetBeans are used for writing,
debugging, and testing the application.
o Key Features: Code assistance, debugging tools, and GUI builders to streamline development.
8. Maven (Optional):
10 | P a g e
o Dependency Management: If used, Maven simplifies the inclusion of libraries (e.g., for
JSON parsing, HTTP requests, or database interaction) and manages project dependencies
efficiently.
o Key Usage: Ensures all required external libraries are included and updated easily.
9. Operating System:
o Cross-Platform Capability: The application is built using Java, which ensures it can run on
multiple operating systems such as Windows, macOS, and Linux without modification.
10. API Key Management:
Security: The OpenWeather API requires an API key for access. The key is securely integrated into
the application to authenticate API requests.
Key Usage: Enables authorized access to the API services while maintaining security best practices.
By incorporating MySQL, the project not only provides real-time weather updates but also enables data
storage for historical analysis and trends, enhancing the application's utility and scope.
10 | P a g e
1. Functional Requirements
User Input Handling
The application must use the OpenWeather API to fetch real-time weather data.
The API call should include:
• An authenticated API key.
• The user’s input (city name or coordinates).
• Units of measurement (e.g., Celsius or Fahrenheit) for consistency.
API response should be processed promptly to avoid delays in the user experience.
Error Handling
113 | P a g
e
Database Operations (MySQL)
Real-Time Functionality
Ensure weather data displayed is up-to-date by querying the API each time a user searches.
Provide a loading indicator while the application fetches data to inform the user about ongoing
processing.
114 | P a g
e
Multithreading for Asynchronous Operations
Use Java’s multithreading capabilities to handle API calls and database operations without
freezing the GUI.
Ensure the user interface remains responsive during long-running tasks like fetching data or
querying the database.
Notify users of critical weather conditions, such as storms or extreme temperatures, if supported
by the API.
Display these alerts prominently in the GUI, such as using color-coded labels.
By addressing these detailed functional requirements, the weather application ensures robust functionality, an
intuitive user experience, and room for future enhancements.
115 | P a g
e
10. ER Diagram
116 | P a g
e
11. Use Case Diagram
117 | P a g
e
118 | P a g
e
12.Flowchart
119 | P a g
e
13.Swing Classes and Methods Used in Weather app
Swing Classes
1. JFrame
Methods:
o setTitle(String title)
o setSize(int width, int height)
o setVisible(boolean visible)
o setDefaultCloseOperation(int operation)
2. JPanel
Methods:
o setLayout(LayoutManager layout)
o add(Component comp)
o setBackground(Color color)
3. JButton
Methods:
o setText(String text)
o addActionListener(ActionListener l)
4. JLabel
Methods:
o setText(String text)
120 | P a g
e
5. JTextField
Methods:
o setText(String text)
o getText()
6. JTextArea
Methods:
o setText(String text)
o getText()
o setEditable(boolean editable)
7. JComboBox
Methods:
o addItem(Object item)
o getSelectedItem()
8. JTable
Methods:
o setModel(TableModel model)
o getValueAt(int row, int column)
9. JOptionPane
Methods:
o showMessageDialog(Component parent, Object message)
o showConfirmDialog(Component parent, Object message)
121 | P a g
e
JDBC Classes and Methods Used
JDBC Classes
1. DriverManager
Methods:
o getConnection(String url, String user, String password)
2. Connection
Methods:
o createStatement()
o prepareStatement(String sql)
o close()
3. Statement
Methods:
o executeUpdate(String sql)
o executeQuery(String sql)
o close()
4. ResultSet
Methods:
o next()
o getString(String columnLabel)
o getInt(String columnLabel)
o close()
Purpose: Manages HTTP requests and responses for fetching weather data from the OpenWeather API.
Methods:
o setRequestMethod(String method): Sets the HTTP method (e.g., GET, POST).
o setRequestProperty(String key, String value): Adds a header property to the
request (e.g., API key).
122 | P a g
e
o getResponseCode(): Retrieves the HTTP response code (e.g., 200 for success).
o getInputStream(): Retrieves the input stream for reading data from the server.
o disconnect(): Closes the connection.
2. URL
123 | P a g
e
14.Output and Test
case Login page
Pre-Requirement Internet
Browser
Environment Setup Windows 11
21 | P a g e
Test Case Test Test Steps Test Inputs Expected Actual Status Comments
ID Scenario Result Result
TC_01 Successful 1. Open Username: User Homepage Pass None
Login the user123 should be displayed
application Password: redirected
2. Enter correctpasswor to the
valid d homepage
username
3. Enter
valid
password
4. Click on
Log in
button
TC_02 Login with 1. Open Username: Error Error Pass None
Empty the Password: message message
Fields application should displayed
2. Leave appear:
username "Username
and and
password Password
fields required"
blank
3. Click on
Log in
button
TC_03 Invalid 1. Open Username: Error Error Pass None
Username the wronguser message message
application Password: should displayed
2. Enter correctpasswor appear:
invalid d "Invalid
username Username
3. Enter or
valid Password"
password
4. Click on
Log in
button
TC_04 Invalid 1. Open Username: Error Error Pass None
Password the user123 message message
application Password: should displayed
2. Enter wrongpassword appear:
valid "Invalid
username Username
3. Enter or
invalid Password"
password
4. Click on
Log in
button
TC_05 Sign up 1. Open None User Sign-up Pass None
Link the should be page
application redirected displayed
2. Click on to the
"Sign up" Sign-up
link page
22 | P a g e
TC_06 Password 1. Open Password: Password Password Pass None
Masking the mypassword characters masked
application should be
2. Enter hidden
characters (e.g.,
in the *******)
password
field
TC_07 Login 1. Open Username: Log in Log in Fail Issue
Button the user123 button button observed
Disabled application Password: should enabled
2. Leave remain
either disabled
username
or
password
blank
TC_08 Responsive 1. Open Window UI UI Pass None
UI the Resizing elements adjusted
application should correctly
2. Resize adjust
the properly
window to without
different overlap
sizes
23 | P a g e
Signup Page
Pre-Requirement Internet
Browser
Environment Setup Windows 11
24 | P a g e
Test Case Test Test Steps Test Inputs Expected Actual Status Comments
ID Scenario Result Result
TC_01 Successful 1. Open Name: John Doe User should Confirmatio Pass None
Sign-Up the Phone: 1234567890 be registered n message
applicatio Email: successfully, displayed
n [email protected] and a
2. Fill all Username: john123 confirmation
the fields Password: message
with valid password123 should
data appear
3. Click on
Sign up
button
TC_02 Sign-Up 1. Open All fields blank Error Error Pass None
with the message message
Empty applicatio should displayed
Fields n appear: "All
2. Leave fields are
all fields required"
blank
3. Click on
Sign up
button
TC_03 Invalid 1. Open Email: invalidemail Error Error Pass None
Email the Other fields valid message message
Format applicatio should displayed
n appear:
2. Enter an "Invalid
invalid email
email format"
format
3. Fill
other
fields with
valid data
4. Click on
Sign up
button
TC_04 Weak 1. Open Password: 123 Error Error Pass None
Password the message message
applicatio should displayed
n appear:
2. Enter a "Password is
weak too weak"
password
3. Fill
other
fields with
valid data
4. Click on
Sign up
button
TC_05 Already 1. Open None User should Log in page Pass None
Have the be displayed
Account applicatio redirected to
Link n the Log in
25 | P a g e
2. Click on page
"Already
have
account?
Log in"
link
TC_06 Password 1. Open Password: Password Password Pass None
Masking the mypassword characters masked
applicatio should be
n hidden (e.g.,
2. Enter *******)
characters
in the
password
field
TC_07 Phone 1. Open Phone: 1234abcd Error Error Pass None
Number the Other fields valid message message
Validation applicatio should displayed
n appear:
2. Enter "Invalid
invalid phone
phone number"
number
3. Fill
other
fields with
valid data
4. Click on
Sign up
button
TC_08 Responsive 1. Open Window Resizing UI elements UI adjusted Pass None
UI the should correctly
applicatio adjust
n properly
2. Resize without
the overlap
window to
different
sizes
26 | P a g e
Get Weather by City name
Pre-Requirement Internet
Browser
Environment Setup Windows 11
Created Date 30/09/2024
Current Time 10.30 Am
27 | P a g e
Test Case Test Test Steps Test Inputs Expected Actual Status Comments
ID Scenario Result Result
TC_01 Fetch 1. Open the City: New Weather Weather Pass None
Weather by application York information info
City 2. Enter a for New displayed
valid city York should
name in the be displayed
input box
3. Click on
"Get
Weather"
button
TC_02 Empty City 1. Open the City: (empty) Error Error Pass None
Field application message message
2. Leave the should displayed
city field appear: "City
empty name cannot
3. Click on be empty"
"Get
Weather"
button
TC_03 Invalid City 1. Open the City: Error Error Pass None
Name application InvalidCity12 message message
2. Enter an 3 should displayed
invalid or appear: "City
non- not found"
existent city
name in the
input box
3. Click on
"Get
Weather"
button
TC_04 Fetch 1. Open the Latitude: Weather Weather Pass None
Weather by application 40.7128 information info
LatLng 2. Click on Longitude: - for the displayed
"LatLng" 74.0060 entered
button coordinates
3. Enter should be
valid displayed
latitude and
longitude
values
4. Click on
"Get
Weather"
button
TC_05 Fetch Map 1. Open the City: Paris Map of Paris Map Pass None
by City application should be displayed
2. Click on displayed
"Get Map"
button
3. Enter a
valid city
name in the
input box
28 | P a g e
TC_06 Responsive 1. Open the Window UI elements UI Pass None
UI application Resizing should adjust adjusted
2. Resize properly correctly
the window without
to different overlap
sizes
TC_07 Weather 1. Open the City: Tokyo Weather data Data Pass None
Data application should be displayed
Format 2. Enter a displayed in correctly
valid city a readable
name format
3. Click on (temperature,
"Get humidity,
Weather" etc.)
button
TC_08 City Name 1. Open the City: LoNDoN Weather Weather Pass None
Case application information info
Insensitivit 2. Enter a for London displayed
y city name should be
in different displayed
cases (e.g.,
"LoNDoN")
3. Click on
"Get
Weather"
button
29 | P a g e
Get Weather by Latitude & Longitude
Pre-Requirement Internet
Browser
Environment Setup Windows 11
Test Case Test Scenario Test Steps Test Expected Result Actual Status Comments
210 | P a g
e
ID Inputs Result
TC_01 Fetch Weather by 1. Open Latitude: Weather Weather Pass None
LatLng the 37.7749 information for the info
application Longitude: entered coordinates displayed
2. Enter -122.4194 should be displayed
valid
latitude
and
longitude
values
3. Click on
"Get
Weather"
button
TC_02 Empty Latitude 1. Open Latitude: Error message Error Pass None
and Longitude the (empty) should appear: message
Fields application Longitude: "Latitude and displayed
2. Leave (empty) Longitude cannot
both be empty"
latitude
and
longitude
fields
empty
3. Click on
"Get
Weather"
button
TC_03 Invalid 1. Open Latitude: Error message Error Pass None
Latitude/Longitud the abc should appear: message
e Values application Longitude: "Invalid displayed
2. Enter xyz Latitude/Longitude
invalid values"
values in
latitude
and
longitude
fields
3. Click on
"Get
Weather"
button
TC_04 Partial Latitude or 1. Open Latitude: Error message Error Pass None
Longitude Input the 40.7128 should appear: message
application Longitude: "Both Latitude and displayed
2. Enter a (empty) Longitude are
value in required"
only one
of the
fields
(latitude or
longitude)
3. Click on
"Get
Weather"
button
211 | P a g
e
TC_05 Weather Data 1. Open Latitude: Weather Weather Pass None
Accuracy the 48.8566 information should info
application Longitude: match the data for matches
2. Enter 2.3522 the entered location location
valid (Paris)
latitude
and
longitude
values
3. Click on
"Get
Weather"
button
TC_06 Responsive UI 1. Open Window UI elements should UI Pass None
the Resizing adjust properly adjusted
application without overlap correctly
2. Resize
the
window to
different
sizes
TC_07 Latitude and 1. Open Latitude: - Error message Error Pass None
Longitude Bounds the 100 should appear: message
application Longitude: "Latitude must be displayed
2. Enter 200 between -90 and 90,
out-of- Longitude must be
bound between -180 and
values for 180"
latitude
and
longitude
3. Click on
"Get
Weather"
button
TC_08 Special Characters 1. Open Latitude: Error message Error Pass None
in LatLng the @!#$ should appear: message
application Longitude: "Invalid characters displayed
2. Enter *&^% in
special Latitude/Longitude"
characters
in latitude
and
longitude
fields
3. Click on
"Get
Weather"
button
212 | P a g
e
15. Conclusion
The Weather App is a robust and user-friendly application that combines the power of Java Swing for its
intuitive graphical interface, JDBC for efficient database management, and HttpURLConnection for
seamless API integration. By leveraging the OpenWeather API, the app provides real-time weather
updates based on user input, whether through city names or geographic coordinates. This ensures
accurate and accessible weather information for users, making it a valuable tool for daily planning and
decision-making.
The integration of MySQL as the backend database adds significant value to the project by enabling the
storage and retrieval of user search history. This functionality not only enhances the user experience by
allowing quick access to previous searches but also serves as a foundation for advanced features like
statistical analysis of weather data or user preferences. The application demonstrates the importance of
combining front-end and back-end technologies for creating functional and interactive software solutions.
From a technical perspective, the project highlights the effective use of Java's diverse ecosystem. The
modular design of the application ensures that each component—UI, database, and API communication
—is independently developed and seamlessly integrated. This approach simplifies future enhancements,
such as integrating weather forecasts, alerts, or additional APIs, ensuring scalability and adaptability to
evolving user needs.
In conclusion, the Weather App is not only a practical application for real-time weather updates but also a
testament to the potential of combining multiple technologies to solve real-world problems. It provides a
solid foundation for further innovation, making it a meaningful contribution to the field of software
development..
16. References
313 | P a g
e
JSON in Java (org.json library)
https://stleary.github.io/JSON-java/
314 | P a g
e