You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
648 B
25 lines
648 B
import java.util.*;
|
|
|
|
public class ExamManager {
|
|
private QuestionGenerator generator = new QuestionGenerator();
|
|
private Set<String> history = new HashSet<>();
|
|
private String type;
|
|
|
|
public ExamManager(String type){
|
|
this.type = type;
|
|
}
|
|
|
|
public List<String> generateExam(int numQuestions){
|
|
List<String> questions = new ArrayList<>();
|
|
for(int i=0;i<numQuestions;i++){
|
|
String q;
|
|
do {
|
|
q = generator.generateQuestion(type);
|
|
} while(history.contains(q));
|
|
history.add(q);
|
|
questions.add(q);
|
|
}
|
|
return questions;
|
|
}
|
|
}
|