Project solution

$12.99 $11.56



You will need to create a math tutor program for elementary school children.  It will generate two numbers and then ask the student to give the correct answer to the math problem. You will need to create a flow chart that diagrams your algorithm


Write a program that will do the following:


  1. Ask the user if they are in first or second grade.
  2. Generate two whole numbers in the following ranges:
    1. First Grade= between 1 and 10.
    2. Second Grade = between 10 and 40.
  3. Ask the student if they wish to work on addition or subtraction.
  4. Display the appropriate math equation to the student and ask them to enter the correct answer.
    1. If the user has asked for subtraction, you must make sure that the smaller number is subtracted from the larger number to ensure there are no negative numbers for the answer.
  5. The program should ask the user for the answer and then determine if the answer is correct or incorrect.
    1. You should keep a running total of correct and incorrect answers.
    2. If the answer is incorrect, give them a chance to enter the correct answer. They are only allowed three chance total to get the correct answer.
    3. After a correct answer or after the third try, you should display the correct answer.
  6. Ask the user if they want to run the program again, or quit the program.
  7. You will need to keep track of the total number tries for all runs.
  8. You will need to write the total number of incorrect and correct answers to a file, call the file txt.
  9. Then read in this information calculate the percentage of correct and incorrect answers.


You can assume the following:

  1. Use the JOptionPane for the data input and output.
  2. Validate all data
    1. Only allow for A for addition and S for subtraction
    2. Don’t allow negative numbers for an answer
  3. Use the printf command to output the data.
  4. Parse data as necessary


Your program must be written using standard programming practices and run without errors.  You need to apply the appropriate data types for the expected variables.  All output needs to look as depicted above.  All calculation must be done correctly.


Items to upload to Moodle:

  1. The .java file
  2. The txt file

Items to hand in:

  1. The flow chart of the algorithm.