Due Date: Saturday 00:00:00
Download [problems]
Weather App Assignment
Introduction
In this assignment, you will build a simple Java application that connects to a weather API and retrieves information about the current weather conditions of a given city.
Objectives
- Familiarize with the basics of Java programming
- Understand how to make HTTP requests to retrieve data from APIs
- Parse and process JSON data in Java
- Use Git for version control and collaborate on a codebase
- Use Maven or Gradle as a package manager
Requirements
- Java 8 or later
- Git
- Maven or Gradle
Tasks
- Get an API key from
https://www.weatherapi.com/
. You need to sign up and verify your account. - Fork this repository and clone the fork to your local machine
- Create a Java project using Maven or Gradle
-
Add org.json to Gradle
build.gradle
file to include the JSON library - Write a Java class
WeatherApp
that does the following:- Prompts the user for a city name
- Parses the JSON response to extract the temperature and humidity
- Prints the temperature and humidity to the console
- Commit your changes and push them to your fork on Github
Evaluation
- Your code should compile and run without any errors
- Your code should correctly retrieve and display the temperature and humidity for a given city
- Your code should be well-organized, readable, properly commented and follows clean code principles
- You should use Git for version control and include meaningful commit messages
Bonus
- Extend the WeatherApp class to also display the current wind speed and direction
- Add error handling to handle cases where the API returns an error or the city name is not found
Submission
- Push your code to your fork on Github
Good luck and happy coding!
Late Policy
- Deadlines won't extend in any circumstances
- You have free 5 late days.
- You can use late days for assignments and not for projects. A late day extends the deadline 24 hours.
- Once you have used all 5 late days, the penalty is 10% for each additional late day.
- At the end of semester, for students who didn't use their late days, extra marks will be considered.