Answered step by step
Verified Expert Solution
Question
1 Approved Answer
public abstract class MathQuestion implements MathQuestionable { / / TODO: Declare private member integer constants x and y / / TODO: Define a default (
public abstract class MathQuestion implements MathQuestionable
TODO: Declare private member integer constants x and y
TODO: Define a default no parameters constructor that assigns
x to RANDOM.nextIntMAXLARGE
y to RANDOM.nextIntMAXSMALL
TODO: Define a parameterized constructor that accepts two integer values
The first parameter must be assigned to x
The second parameter must be assigned to y
TODO: Define public accessor methods getX and getY
public String getQuestionOperationType op
return "What is x opgetSymbol y ;
class AdditionQuestion extends MathQuestion
This class definition should give you a basic idea for how to define the other
operation classes. Keep in mind the other characteristics each operation might have.
public AdditionQuestion
super;
public AdditionQuestionint px int py
superpx py;
public String getQuestion
return super.getQuestionOperationTypeADD;
public int getCorrectAnswer
return getX getY;
class DivisionQuestion extends MathQuestion
private static int x RANDOM.nextIntMAXLARGE;
private static int y RANDOM.nextIntx;
TODO: Define default constructor to call parent class constructor and passing x and y as arguments
You will also need to reassign new random values to both x and y as shown in the initial assignment statements
TODO: Define a parameterized constructor that accepts two integers and passes these in a call to the parent constructor
TODO: Define getQuestion that returns a String and makes a call to the parent getQuestion method.
You will need to pass OperationType.DIVIDE as the argument
TODO: Define getCorrectAnswer that returns an integer result of x y this is not as simple as it looks!
class ExponentQuestion extends MathQuestion
private static int x RANDOM.nextIntMAXBASE;
private static int y RANDOM.nextIntMAXEXPONENT;
TODO: Define default constructor to call parent class constructor and passing x and y as arguments
You will also need to reassign new random values to both x and y as shown in the initial assignment statements
TODO: Define a parameterized constructor that accepts two integers and passes these in a call to the parent constructor
TODO: Define getQuestion that returns a String and makes a call to the parent getQuestion method.
You will need to pass OperationType.EXPONENT as the argument
TODO: Define getCorrectAnswer that returns an integer result of Math.powx ythis is not as simple as it looks!
class ModuloQuestion extends MathQuestion
private static int x RANDOM.nextIntMAXLARGE;
private static int y RANDOM.nextIntx;
TODO: Define default constructor to call parent class constructor and passing x and y as arguments
You will also need to reassign new random values to both x and y as shown in the initial assignment statements
TODO: Define a parameterized constructor that accepts two integers and passes these in a call to the parent constructor
TODO: Define getQuestion that returns a String and makes a call to the parent getQuestion method.
You will need to pass OperationType.MODULO as the argument
TODO: Define getCorrectAnswer that returns an integer result of x y this is not as simple as it looks!
class MultiplicationQuestion extends MathQuestion
private static int x RANDOM.nextIntMAXMULTIPLE;
private static int y RANDOM.nextIntMAXMULTIPLE;
TODO: Define default constructor to call parent class constructor and passing x and y as arguments
You will also need to reassign new random values to both x and y as shown in the initial assignment statements
TODO: Define a parameterized constructor that accepts two integers and passes these in a call to the parent constructor
TODO: Define getQuestion that returns a String and makes a call to the parent getQuestion method.
You will need to pass OperationType.MULTIPLY as the argument
TODO: Define getCorrectAnswer that returns an integer result of x y this is not as simple as it looks!
class SubtractionQuestion extends MathQuestion
private static int x RANDOM.nextIntMAXSMALL MAXSMALL ;
private static int y RANDOM.nextIntMAXSMALL;
TODO: Define default constructor to call parent class constructor and passing x and y as arguments
You will also need to reassign new random values to both x and y as shown in the initial assignment statements
TODO: Define a parameterized cons
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started