Welcome to Your Second Assignment in the Advanced Programming Course!
In this assignment, you will develop a Java application that functions as a simple news aggregator. Your task is to fetch real-time news data from "News API" and present the latest headlines in an organized manner. This project will help you gain hands-on experience with API integration and parsing json.
By completing this assignment, you will:
- Reinforce your understanding of basic Object-Oriented Programming (OOP) principles such as designing classes, using constructor, encapsulation and apply them effectively.
- Gain familiarity with the process of issuing HTTP requests to APIs and parsing JSON data in Java.
- Learn to manage and track changes in your project using Git.
Before getting started, ensure you have the following installed:
- Git
- Java 23
- Gradle as a package manager
- Fork this repository and clone it to your local machine.
- Create a new branch named development and switch to it. All development should be done in this branch.
- We are getting our information from https://NewsAPI.org. You should create an account in the site to get a APIKEY and pass it to the constructor of Infrastructure class.
- Complete the Infrastructure class methods as told in the code comments.
- Design the News class with attributes "title", "description", "sourceName", "author", "url" and "publishedAt" and the method "displayNews" to display all information of that news.
- Implement a menu in your Main class. This menu should contain the titles of news. The user should be able to choose the desired article to read more about it.
- Add error handling to handle cases where the API returns an error or the information is not found.
- Write a comprehensive report detailing the tasks you have completed and any challenges you encountered. Your report should be written in Markdown format. Write your report in the provided Report.md file located in the repository, which serves as a simple template for structuring your report.
- Commit your changes and push them to your GitHub repository.
- Submit a pull request from your develop branch to your main branch. Your mentor will review the pull request, score your assignment and merge it upon approval.
Your submission will be assessed based on:
-
Functionality:
- Error-free compilation and execution.
- Accurate retrieval and display of News data.
-
Code Quality:
- Clear structure, readability, and proper commenting.
- Adherence to clean code principles.
-
Proficiency:
- You must fully understand and explain your code.
- Use of AI is prohibited. If AI-generated code is submitted, you must be able to explain it in detail. Failure to do so will result in no marks.
Ensure your work is original and reflects your understanding. Unexplained or unjustified code will not be credited.
For additional challenges and learning opportunities, consider the following bonus objectives:
- Save Favorite Articles: Allow users to save their favorite news articles to a file for future reference. Your app should be able to read those from file and display it.
- Change the publish date format: Convert the news publication dates from the Gregorian calendar to the Solar Hijri calendar.
- Create a GUI: Provide a simple GUI (Graphical User Interface) for your project. The recommended library to do so is JavaFX. JavaFX empowers developers to create dynamic and engaging user interfaces for their Java applications, offering a modern and versatile platform for building cross-platform desktop, web, and mobile applications
The deadline for submitting your code is Esfand 22nd.
For assistance with this assignment, you may refer to the following resources:
🔗 Getting Json Data From A RESTFUL API Using Java
🔗 Reading / Parsing Data from a JSONObject