```
import java.util.Scanner;
public class MathTutor {
Scanner input = new Scanner(System.in);
int numQuestions;
int choice;
int numCorrect;
public MathTutor (){
numQuestions = choice = numCorrect = 0;
}
public int getNumQuestions(){ {
System.out.print("How many questions? ");
numQuestions = input.nextInt();
if (numQuestions < 1)
{
System.out.println("Invalid - must ask at least 1 question");
}
}return numQuestions;}
public int getQuestionType(){ while (choice < 1 || choice > 4)
{
System.out.println("Please select the type of questions you would like");
System.out.println("1) Addition");
System.out.println("2) Subtraction");
System.out.println("3) Multiplication");
System.out.println("4) Division");
System.out.print("Type: ");
choice = input.nextInt();
if (choice < 1 || choice > 4)
{
System.out.println("Choice must be in the range 1-4");
}
}return choice;}
public void askQuestions() {
for (int i = 0; i < numQuestions; i++)
{
int num1 = genRandomNum(1);
int num2 = genRandomNum(1);
int sign = choice;
if (sign == 5)
{
sign = (int)(Math.random() * 4 + 1);
}
switch(sign)
{
case 1: addition(num1, num2);
break;
case 2: subtraction(num1, num2);
break;
case 3: multiplication(num1, num2);
break;
case 4: division(num1, num2);
break;
default: System.out.println("Error");
System.exit(1);
}
}
}
public int genRandomNum(int difficulty) {
if (difficulty == 1)
{
return (int)(Math.random() * 10);
}
else
{
return (int)(Math.random() * 100);
}
}
public void addition(int num1, int num2) {
System.out.print("What is " + num1 + " + " + num2 + "? ");
int answer = input.nextInt();
if (num1 + num2 == answer)
{
System.out.println("Correct");
numCorrect++;
}
else
{
System.out.println("Incorrect -> " + num1 + " + " + num2 + " = " + num1+num2);
}
}
public void subtraction(int num1, int num2) {
System.out.print("What is " + num1 + " - " + num2 + "? ");
int answer = input.nextInt();
if (num1 - num2 == answer)
{
System.out.println("Correct");
numCorrect++;
}
else
{
System.out.println("Incorrect -> " + num1 + " - " + num2 + " = " + num1+num2);
}
}
public void multiplication(int num1, int num2) {
System.out.print("What is " + num1 + " * " + num2 + "? ");
int answer = input.nextInt();
if (num1 * num2 == answer)
{
System.out.println("Correct");
numCorrect++;
}
else
{
System.out.println("Incorrect -> " + num1 + " * " + num2 + " = " + num1+num2);
}
}
public void division(int num1, int num2) {
boolean quotientCorrect = false;
boolean remainderCorrect = false;
System.out.print("What is the quotient of " + num1 + " / " + num2 + "? ");
int answer = input.nextInt();
System.out.print("What is the remainder of " + num1 + " / " + num2 + "? ");
int remainder = input.nextInt();
if (num1 / num2 == answer)
{
quotientCorrect = true;
}
if (num1 % num2 == remainder)
{
remainderCorrect = true;
}
if (quotientCorrect && remainderCorrect)
{
System.out.println("Correct");
numCorrect++;
}
else
{
System.out.println("Incorrect -> " + num1 + " / " + num2 + " = " + num1/num2 + "r" + num1%num2);
}
}
public void printReport(long totalTime) {
System.out.println("Number of correct responses: " + numCorrect + "/" + numQuestions);
double percent = numCorrect/numQuestions;
System.out.println("Your percentage: " + percent + "%");
System.out.println("Total time taken: " + totalTime/1000 + "s");
System.out.println("Average time per question: " + (totalTime/numQuestions)/1000 + "s");
}
}
```

This is what I have so far.... I think. Here's my assignment:

Create a Java class that will help elementary school students learn basic arithmetic operations (addition, subtraction, multiplication, and division). The class will contain a menu that allows the user to choose the operation. It will then use a Random object to produce two positive one-digit integers. It will then prompt the user with a question, such as

How much is 6 plus 4?

The student will input the answer. Another method will verify if the answer is correct. Use another Random object to generate a number in the range of 1-4. If the student's answer is correct, the random number will be used to indicate which message to display from a String array of correct responses:

Very good!

Excellent!

Nice work!

Keep up the good work!

If the student's answer is incorrect use the random number to indicate which element of the incorrect responses String array to display:

No. Please try again.

Wrong. Try once more.

Don't give up!

No. Keep trying.

For each operation that the student selects, they are to answer 10 questions. The program should monitor the students's performance for that particular math operation and display the percentage that the user answered correctly. If the percentage is lower than 75%, display "Please ask your teacher for extra help with __________."

Allow the user to return to the menu after finishing an operation, so they can choose to try another math operation or quit the program.

Note: this assignment contains two classes: The arithmetic program and a client.

I'm in the middle of getting the grading program/set amount of questions/varied correct and incorrect responses added to the program. My main issue is... No matter what I do in my client, I can't seem to get this to run.... Horribly enough, at this stage of sleep depravation, I'm not even making sense of why this program would want to be separated into client/main file, or even how to make a client for something that doesn't even need anything set/inputted except for the number of questions you want the student to do. Can anyone give me a push in the right direction?

Thanks

~Will