Answer to Question #259715 in Java | JSP | JSF for Lee

Question #259715

·             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.

 



1
Expert's answer
2021-11-01T18:50:25-0400
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
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS