· Question class. It is a class to hold the examination question details in multiple- choice question mode. This class should consist of the following details:
§ Question text (e.g. Integer data type holding how many bytes in memory?)
§ Options from A to D (e.g. A-2, B-3, C-4, D-8)
§ Actual answer (e.g. C)
Provide basic functionalities for this class.
public class Question {
private String text;
private Map<Variant, String> variants;
private Variant answer;
public Question(String text, Map<Variant, String> variants, Variant answer) {
this.text = text;
this.variants = variants;
this.answer = answer;
}
public Variant getAnswer() {
return this.answer;
}
}
enum Variant {
A, B, C, D
}
Comments
Leave a comment