Package SolvishR

Class DivisionQuestion

java.lang.Object
SolvishR.Question
SolvishR.DivisionQuestion

public class DivisionQuestion extends Question
Represents a question related to division. Extends the Question class and provides functionality to generate division questions with random numbers.
Version:
1.0
Author:
Adib Sakhawat
  • Constructor Details

    • DivisionQuestion

      public DivisionQuestion(double number1, double number2)
      Constructs a division question with specified numbers.
      Parameters:
      number1 - The dividend.
      number2 - The divisor.
    • DivisionQuestion

      public DivisionQuestion()
      Constructs a random division question with numbers generated between 10 and 10000 (inclusive). The divisor is generated to be between 10 and the value of the dividend.
  • Method Details

    • checkAnswer

      public void checkAnswer(String givenAnswer)
      Checks the provided answer for correctness.
      Specified by:
      checkAnswer in class Question
      Parameters:
      givenAnswer - The answer provided by the user.
      Throws:
      NumberFormatException - If the provided answer is not a valid number.
    • show

      public void show()
      Displays the division question.
      Specified by:
      show in class Question