How vishalla/oops-assingment-1 works
Project type and purpose
• This is a standalone, Java-based, command-line quiz training application.
• Purpose: Load a text file of questions (TF, MC, SA), prompt a player for answers, track score, and display results.
File structure
• Top-level:
• src/ – contains all Java classes
• Player.java – stores player’s name and score
• Question.java – abstract base class
• QuestionTF.java, QuestionMC.java, QuestionSA.java – concrete subclasses
• QuizBowl.java – main driver, orchestrates I/O, parsing, game loop
• No external services or databases—only file I/O and console I/O
• Build script is implicit (javac), run command is java QuizBowl
README for additional insights
• Describes question file format and program flow
• Emphasizes three question types and a simple CLI interface
• No mention of GUI/web/etc., confirming a single-process, CLI architecture
Main components and interactions
a. Components
1. External File System
• “Question File” (sample.txt or user-provided)
2. CLI I/O Layer
• Standard Input (stdin), Standard Output (stdout)
3. Controller / Engine
• QuizBowl (main class)
4. Domain Model
• Player
• Question (abstract)
• QuestionTF, QuestionMC, QuestionSA
5. Parser / Factory
• Logic inside QuizBowl that reads lines, creates correct Question subclass
b. Relationships & Data Flow
• On startup, QuizBowl reads filename from CLI
• QuizBowl invokes FileReader → Parser → produces List<Question>
• For each Question in list:
• QuizBowl calls question.ask() (polymorphic dispatch)
• Reads answer from CLI, routes to question.evaluate(), updates Player.score
• At end, QuizBowl prints Player.score to CLI
c. Architectural patterns & principles
• OOP & Inheritance (Question base class, subtype polymorphism)
• Single Responsibility:
• Question subclasses handle their own parsing and evaluation
• Player tracks identity & score
• QuizBowl orchestrates flow & I/O
d. Key technologies & libraries
• Java SE (java.io for FileReader/BufferedReader, java.util for collections)
• No frameworks; direct console I/O
Step-by-step creation
2. “Parser / Factory” connecting to a cluster of Question subclasses (inheritance tree under abstract Question).
• Association to Player (1)
• Loops over Questions (n)
5. End of flow: QuizBowl → CLI “Display final score.”