Package SolvishR
Class ExamFactory
java.lang.Object
SolvishR.ExamFactory
The SolvishR.ExamFactory class is responsible for creating instances of different types of exams.
It follows the Singleton pattern to ensure only one instance is created.
It provides methods to get a non-timed exam, a timed exam with a specified time limit, and interactively get user preferences for exam types and questions.
- Version:
- 1.0
- Author:
- Adib Sakhawat
-
Method Summary
Modifier and TypeMethodDescriptiongetExam()Gets a non-timed exam with an empty list of questions.getExam(int timeLimit) Gets a timed exam with a specified time limit and an empty list of questions.Interactively gets user preferences for exam types and questions, then creates and returns the corresponding exam.static ExamFactoryGets the singleton instance of the SolvishR.ExamFactory.
-
Method Details
-
getInstance
Gets the singleton instance of the SolvishR.ExamFactory.- Returns:
- The singleton instance of the SolvishR.ExamFactory.
-
getExam
Gets a non-timed exam with an empty list of questions.- Returns:
- A non-timed exam.
-
getExam
Gets a timed exam with a specified time limit and an empty list of questions.- Parameters:
timeLimit- The time limit for the exam in minutes.- Returns:
- A timed exam.
- Throws:
IllegalArgumentException- If the time limit is not a positive integer.
-
getExamChoice
Interactively gets user preferences for exam types and questions, then creates and returns the corresponding exam.- Returns:
- An exam based on user preferences.
- Throws:
IllegalArgumentException- If the exam type is not recognized.
-