{"id":23510921,"url":"https://github.com/shakhawat1998/simple-project-on-java","last_synced_at":"2025-05-13T17:17:53.578Z","repository":{"id":260628730,"uuid":"867770878","full_name":"Shakhawat1998/Simple-Project-on-Java","owner":"Shakhawat1998","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-01T12:55:16.000Z","size":77,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-13T17:17:51.159Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Shakhawat1998.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-04T17:28:17.000Z","updated_at":"2024-12-19T13:53:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"9e8c0bfa-edc0-4b13-b709-2c762b1002d9","html_url":"https://github.com/Shakhawat1998/Simple-Project-on-Java","commit_stats":null,"previous_names":["shakhawat1998/simple-project-on-java-road-to-sdet","shakhawat1998/simple-project-on-java"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shakhawat1998%2FSimple-Project-on-Java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shakhawat1998%2FSimple-Project-on-Java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shakhawat1998%2FSimple-Project-on-Java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shakhawat1998%2FSimple-Project-on-Java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shakhawat1998","download_url":"https://codeload.github.com/Shakhawat1998/Simple-Project-on-Java/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253990506,"owners_count":21995776,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-25T12:12:48.128Z","updated_at":"2025-05-13T17:17:53.553Z","avatar_url":"https://github.com/Shakhawat1998.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Project Title: MCQ Quiz Management System with Admin and Student Login\n\n## Project Summary:\n\nThe **MCQ Quiz Management System** is a simple command-line-based application that enables two types of users: Admin and Student. The admin user can log in and add multiple-choice questions (MCQs) to a quiz bank, storing questions with four options and an answer key in a `quiz.json` file. Students can log in to take a quiz where 10 random questions are presented from the quiz bank. The system evaluates the student's answers and provides a score based on the number of correct answers.\n\nKey Features:\n- **Admin User:**\n  - Add new MCQ questions to the quiz bank.\n  - Questions are saved in JSON format with four options and an answer key.\n  \n- **Student User:**\n  - Take a quiz with 10 random questions from the quiz bank.\n  - Real-time scoring based on correct answers.\n  - Feedback based on the score, ranging from \"Excellent\" to \"Very Sorry, you are failed.\"\n  \nThe system uses `users.json` to handle login credentials for both admins and students, and `quiz.json` to manage the quiz bank.\n\nThis project can be expanded for educational purposes, quizzes, or test automation.\n\n## Required Tools \u0026 Technologies:\n\n1. **Java JDK 17**\n2. **Gradle Build Tool**\n3. **Simple JSON Library**\n4. **IntelliJ IDEA**\n\n# How to Run the Whole Project in IntelliJ IDEA\n\n1. **Clone the Repository**\n2. **Open IntelliJ IDEA**\n3. **Import the Project**\n4. **Configure the Project SDK**\n5. **Add Dependencies**\n   - Add Simple json dependency in `build.gradle`\n7. **Build the Project**\n8. **Run the Main Class**\n   - Right-click on `HomePage.java` and select `Run 'HomePage.main()'`.\n9. **Interact with the Application**\n   - Follow the console prompts to log in and use the application.\n10. **Stop the Application**\n\n\n# Whole Project Architecture\n\nThe project is divided into distinct modules (Java classes) that handle specific functionalities, such as user login,quiz management, and file handling. Each module has a specific purpose and can be modified independently. \n\n1. **Application Start:**\n   - The application begins execution in the `HomePage` class.\n\n2. **Loading Data:**\n   - The `HomePage` class calls `FileSystem.loadUsers()` to load user data from `user.json`.\n   - It then calls `FileSystem.loadQuestions()` to load quiz questions from `quiz.json`.\n\n3. **User Authentication:**\n   - The `HomePage` class invokes `UserLogin.login(scanner)` to handle user login.\n   - The user is prompted to enter their username and password.\n\n4. **User Role Verification:**\n   - If the entered credentials match those in `user.json`:\n     - **If the user is an Admin:**\n       - The system directs them to the `QuizSystem.adminMenu(scanner)` method.\n     - **If the user is a Student:**\n       - The system directs them to the `QuizSystem.studentQuiz(scanner)` method.\n   - If the credentials are incorrect, the user is prompted to try again.\n\n5. **Admin Functionality:**\n   - In the `adminMenu()`, the admin can create and add new quiz questions:\n     - The admin inputs the question text, four options, and the correct answer key.\n     - This information is saved in `quiz.json`.\n     - The admin can continue adding questions or choose to quit.\n\n6. **Student Functionality:**\n   - In the `studentQuiz()`, students can take a quiz:\n     - They are presented with 10 random questions selected from the quiz bank.\n     - After answering, the system tallies the score based on correct answers.\n     - Feedback is given based on their score (Excellent, Good, Very Poor, or Failed).\n\n7. **Result Display:**\n   - After the quiz, the student is prompted to either take the quiz again or quit the application.\n\n8. **Data Persistence:**\n   - The `FileSystem` class manages data persistence:\n     - It reads user credentials from `user.json` and quiz questions from `quiz.json`.\n     - When an admin adds a question, it saves the updated question bank back to `quiz.json`.\n\nThis flow illustrates how the different components of the application interact with each other to create a functional quiz system for both admins and students.\n\n# Java Concepts Used in the Project\n\n1. **File Handling:**\n   - The project reads and writes data to JSON files (`user.json` and `quiz.json`) using `FileReader` and `FileWriter` classes.\n   - This ensures data persistence across application runs.\n\n2. **JSON Parsing and Manipulation:**\n   - The `org.json.simple` library is used to parse JSON data and work with `JSONArray` and `JSONObject`.\n   - JSON is used to store user credentials and quiz questions, making it easy to handle structured data.\n\n3. **Exception Handling:**\n   - The project uses `try-catch` blocks and the `throws` keyword to handle potential `IOException` and `ParseException` that might occur during file operations.\n   - This ensures smooth error handling and provides feedback in case of issues.\n\n4. **Control Flow:**\n   - The program uses basic control flow constructs like `if-else` statements and loops (`for` and `while`) to direct the application logic based on user input and role (admin or student).\n\n5. **Scanner for Input Handling:**\n   - `Scanner` is used to capture user input from the console, enabling interactive login and quiz functionality.\n   - It reads inputs like usernames, passwords, questions, and answers in a user-friendly manner.\n\n6. **Method Calls and Code Modularity:**\n   - The program is divided into multiple classes (`HomePage`, `UserLogin`, `QuizSystem`, and `FileSystem`), each having specific methods to handle distinct functionality (e.g., login, adding questions, taking quizzes).\n   - This modular approach improves code organization and readability.\n\n7. **Recursion:**\n   - In the `UserLogin.login()` method, recursion is used to re-prompt the user for credentials in case of an incorrect login attempt.\n\n8. **Randomization:**\n   - The `Random` class is used in the `QuizSystem.studentQuiz()` method to randomly shuffle and present quiz questions to students, ensuring a varied set of questions in each quiz attempt.\n\n9. **String Manipulation:**\n   - The program frequently uses string methods (e.g., `equals()`, `trim()`, and `equalsIgnoreCase()`) to handle user inputs and compare data such as usernames, passwords, and answer keys.\n  \n# A Demonstration Video of How to Run the Project\n\nA simple demonstration video of the project is added in this [link](https://drive.google.com/file/d/1qKLzXhz68kHyQamSHaHGEJbWp_5ZaNsE/view?usp=sharing)\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshakhawat1998%2Fsimple-project-on-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshakhawat1998%2Fsimple-project-on-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshakhawat1998%2Fsimple-project-on-java/lists"}