├── README.md ├── analysis └── analyze_results.py ├── assets └── result.png ├── data ├── questions.json └── results.json ├── lib └── gson-2.10.1.jar └── src └── com └── quizfusion ├── Question.class ├── Question.java ├── QuizEngine.class ├── QuizEngine.java ├── QuizFusion.class ├── QuizFusion.java ├── ResultExporter.class └── ResultExporter.java /README.md: -------------------------------------------------------------------------------- 1 | # 🎯 QuizFusion 2 | 3 | **QuizFusion** is a modular, multi-language quiz engine built in Java, powered by JSON-based question banks and Python-driven result analytics. Designed for developers, learners, and educators who want a clean, branded, and extensible quiz platform. 4 | --- 5 | 6 | ## 🧠 Features 7 | 8 | - ✅ Java-powered quiz engine with dynamic question loading 9 | - 📦 JSON-based question bank for easy editing and expansion 10 | - 📊 Python analytics with pie chart visualization 11 | - 📁 Result export to JSON for cross-language integration 12 | - 🧩 Modular file structure for clarity and scalability 13 | --- 14 | 15 | ## 🚀 How to Run 16 | 17 | ### 🔧 Compile Java files with Gson: 18 | 19 | ```bash 20 | javac -cp "lib/gson-2.10.1.jar" src/com/quizfusion/*.java 21 | ``` 22 | # Run the quiz engine: 23 | ```bash 24 | java -cp "lib/gson-2.10.1.jar;src" com.quizfusion.QuizFusion 25 | ``` 26 | 🧪 Sample Java Output 27 | text 28 | ? What is the capital of France? 29 | 30 | 0) Berlin 31 | 1) Madrid 32 | 2) Paris 33 | 3) Rome 34 | Your answer: 2 35 | ✅ Correct! 36 | 37 | ? Which language runs in a web browser? 38 | 39 | 0) Java 40 | 1) C 41 | 2) Python 42 | 3) JavaScript 43 | Your answer: 3 44 | ✅ Correct! 45 | 46 | ? Who developed Java? 47 | 48 | 0) Microsoft 49 | 1) Sun Microsystems 50 | 2) Apple 51 | 3) Google 52 | Your answer: 3 53 | ❌ Incorrect. Correct answer: Sun Microsystems 54 | 55 | 🎯 Final Score: 2 / 3 56 | 📁 Results exported to data/results.json 57 | 📊 Python Result Analysis 58 | 📦 Install matplotlib: 59 | ```bash 60 | 📈 Run the analysis script: 61 | 62 | pip install matplotlib 63 | python analysis/analyze_results.py 64 | ``` 65 | 🖼️ Pie Chart Output: 66 | ✅ Correct: 66.7% 67 | 68 | ❌ Incorrect: 33.3% 69 | 70 | The chart clearly visualizes performance distribution: 71 | 72 | 🟩 Correct — 2 out of 3 73 | 🟥 Incorrect — 1 out of 3. 74 | 75 | ## 🖼️ Screenshot 76 | 77 | Here’s a sample run of QuizFusion with result analysis: 78 | 79 | ![QuizFusion Screenshot](assets/result.png) 80 | 81 | 📄 JSON Question Bank 82 | ```json 83 | [ 84 | { 85 | "prompt": "What is the capital of France?", 86 | "options": ["Berlin", "Madrid", "Paris", "Rome"], 87 | "correctIndex": 2 88 | }, 89 | { 90 | "prompt": "Which language runs in a web browser?", 91 | "options": ["Java", "C", "Python", "JavaScript"], 92 | "correctIndex": 3 93 | }, 94 | { 95 | "prompt": "Who developed Java?", 96 | "options": ["Microsoft", "Sun Microsystems", "Apple", "Google"], 97 | "correctIndex": 1 98 | } 99 | ] 100 | ``` 101 | 102 | 🖋️ Author 103 | Crafted by Murad — visionary full-stack developer and system architect. Branded, modular, and elegant — just the way code should be. 104 | -------------------------------------------------------------------------------- /analysis/analyze_results.py: -------------------------------------------------------------------------------- 1 | import json 2 | import matplotlib.pyplot as plt 3 | 4 | # Simulated result data (can be exported from Java later) 5 | results = { 6 | "total": 3, 7 | "score": 2 8 | } 9 | 10 | # Pie chart 11 | labels = ['Correct', 'Incorrect'] 12 | sizes = [results['score'], results['total'] - results['score']] 13 | colors = ['green', 'red'] 14 | 15 | plt.figure(figsize=(5,5)) 16 | plt.pie(sizes, labels=labels, colors=colors, autopct='%1.1f%%') 17 | plt.title('QuizFusion Result Analysis') 18 | plt.show() 19 | -------------------------------------------------------------------------------- /assets/result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuradIsazade777/QuizFusion/3ad96fe0ffa28566e7aa6640326d966d442b548c/assets/result.png -------------------------------------------------------------------------------- /data/questions.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "prompt": "What is the capital of France?", 4 | "options": ["Berlin", "Madrid", "Paris", "Rome"], 5 | "correctIndex": 2 6 | }, 7 | { 8 | "prompt": "Which language runs in a web browser?", 9 | "options": ["Java", "C", "Python", "JavaScript"], 10 | "correctIndex": 3 11 | }, 12 | { 13 | "prompt": "Who developed Java?", 14 | "options": ["Microsoft", "Sun Microsystems", "Apple", "Google"], 15 | "correctIndex": 1 16 | } 17 | ] 18 | -------------------------------------------------------------------------------- /data/results.json: -------------------------------------------------------------------------------- 1 | {"score":3,"total":3} -------------------------------------------------------------------------------- /lib/gson-2.10.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuradIsazade777/QuizFusion/3ad96fe0ffa28566e7aa6640326d966d442b548c/lib/gson-2.10.1.jar -------------------------------------------------------------------------------- /src/com/quizfusion/Question.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuradIsazade777/QuizFusion/3ad96fe0ffa28566e7aa6640326d966d442b548c/src/com/quizfusion/Question.class -------------------------------------------------------------------------------- /src/com/quizfusion/Question.java: -------------------------------------------------------------------------------- 1 | package com.quizfusion; 2 | 3 | public class Question { 4 | private String prompt; 5 | private String[] options; 6 | private int correctIndex; 7 | 8 | public Question(String prompt, String[] options, int correctIndex) { 9 | this.prompt = prompt; 10 | this.options = options; 11 | this.correctIndex = correctIndex; 12 | } 13 | 14 | public String getPrompt() { 15 | return prompt; 16 | } 17 | 18 | public String[] getOptions() { 19 | return options; 20 | } 21 | 22 | public int getCorrectIndex() { 23 | return correctIndex; 24 | } 25 | 26 | public boolean isCorrect(int userChoice) { 27 | return userChoice == correctIndex; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/com/quizfusion/QuizEngine.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuradIsazade777/QuizFusion/3ad96fe0ffa28566e7aa6640326d966d442b548c/src/com/quizfusion/QuizEngine.class -------------------------------------------------------------------------------- /src/com/quizfusion/QuizEngine.java: -------------------------------------------------------------------------------- 1 | package com.quizfusion; 2 | 3 | import com.google.gson.*; 4 | import java.io.FileReader; 5 | import java.util.*; 6 | 7 | public class QuizEngine { 8 | private List questions = new ArrayList<>(); 9 | private int score = 0; 10 | 11 | public void loadQuestions(String filePath) { 12 | try (FileReader reader = new FileReader(filePath)) { 13 | JsonArray array = JsonParser.parseReader(reader).getAsJsonArray(); 14 | for (JsonElement elem : array) { 15 | JsonObject obj = elem.getAsJsonObject(); 16 | String prompt = obj.get("prompt").getAsString(); 17 | JsonArray opts = obj.get("options").getAsJsonArray(); 18 | String[] options = new String[opts.size()]; 19 | for (int i = 0; i < opts.size(); i++) { 20 | options[i] = opts.get(i).getAsString(); 21 | } 22 | int correct = obj.get("correctIndex").getAsInt(); 23 | questions.add(new Question(prompt, options, correct)); 24 | } 25 | } catch (Exception e) { 26 | System.out.println("❌ Error loading questions: " + e.getMessage()); 27 | } 28 | } 29 | 30 | public void start() { 31 | Scanner scanner = new Scanner(System.in); 32 | for (Question q : questions) { 33 | System.out.println("\n❓ " + q.getPrompt()); 34 | String[] opts = q.getOptions(); 35 | for (int i = 0; i < opts.length; i++) { 36 | System.out.println(" " + i + ") " + opts[i]); 37 | } 38 | System.out.print("Your answer: "); 39 | int choice = scanner.nextInt(); 40 | if (q.isCorrect(choice)) { 41 | System.out.println("✅ Correct!"); 42 | score++; 43 | } else { 44 | System.out.println("❌ Incorrect. Correct answer: " + opts[q.getCorrectIndex()]); 45 | } 46 | } 47 | System.out.println("\n🎯 Final Score: " + score + " / " + questions.size()); 48 | } 49 | 50 | public int getScore() { 51 | return score; 52 | } 53 | 54 | public int getTotal() { 55 | return questions.size(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/com/quizfusion/QuizFusion.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuradIsazade777/QuizFusion/3ad96fe0ffa28566e7aa6640326d966d442b548c/src/com/quizfusion/QuizFusion.class -------------------------------------------------------------------------------- /src/com/quizfusion/QuizFusion.java: -------------------------------------------------------------------------------- 1 | package com.quizfusion; 2 | 3 | public class QuizFusion { 4 | public static void main(String[] args) { 5 | QuizEngine engine = new QuizEngine(); 6 | engine.loadQuestions("data/questions.json"); 7 | engine.start(); 8 | 9 | ResultExporter.exportToJson(engine.getScore(), engine.getTotal(), "data/results.json"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/com/quizfusion/ResultExporter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuradIsazade777/QuizFusion/3ad96fe0ffa28566e7aa6640326d966d442b548c/src/com/quizfusion/ResultExporter.class -------------------------------------------------------------------------------- /src/com/quizfusion/ResultExporter.java: -------------------------------------------------------------------------------- 1 | package com.quizfusion; 2 | 3 | import com.google.gson.JsonObject; 4 | import java.io.FileWriter; 5 | import java.io.IOException; 6 | 7 | public class ResultExporter { 8 | 9 | public static void exportToJson(int score, int total, String filePath) { 10 | JsonObject result = new JsonObject(); 11 | result.addProperty("score", score); 12 | result.addProperty("total", total); 13 | 14 | try (FileWriter writer = new FileWriter(filePath)) { 15 | writer.write(result.toString()); 16 | System.out.println("📁 Results exported to " + filePath); 17 | } catch (IOException e) { 18 | System.out.println("❌ Failed to export results: " + e.getMessage()); 19 | } 20 | } 21 | } 22 | --------------------------------------------------------------------------------