I have a code I need (I am a
school student and before you say figure it out on your own, stop while
you can.) and I am Stuck. I need to make 4 modifications to this code
and I can't seem to do any of them.
The I am Attempting to Make:
/* Name: Math.Random Mods
Date: January 21st 2013 */
public class Summative2
public static void main (String args)
String output = "", output1 = "";
JOptionPane.showMessageDialog (null, "Welcome. Press OK to begin", "Random Numbers Game", JOptionPane.QUESTION_MESSAGE);
for (int counter2 = 1 ; counter2 <= 10 ; counter2++)
value = 1 + (int) (Math.random () * 9);
value2 = 1 + (int) (Math.random () * 9);
output = value + " * " + value2;
output1 = JOptionPane.showInputDialog ("What is " + output + "?");
input = Integer.parseInt (output1);
Answer = value*value2;
value3 = 1 + (int) (Math.random() * 4);
word = "Awesome";
word = "Perfect";
word = "Flawless";
word = "YOU'RE UNSTOPPABLE";
value4 = 1 + (int) (Math.random() * 3);
word2 = "Try Again";
word2 = "Sorry";
word2 = "Don't give up.";
word2 = "Durrrrrr";
if (input != Answer)
JOptionPane.showMessageDialog (null, "NOPE", "FAIL", JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog (null, "CORRECT", "PASS", JOptionPane.INFORMATION_MESSAGE);
while (input != Answer);
What The Mods need to be:
Modification #1: Modify the program from assignment 13.Random Numbers so
the various comments are printed for each correct answer and each
incorrect answer as follows:
Responses to a correct answer
Keep up the good work!
Responses to an incorrect answer
No. Please try again.
Wrong. Try once more.
Don’t give up.
Use random-number generation to choose a number from 1 to 4 that will be
used to select an appropriate response to each answer. Use a switch
structure to issue the responses.
More sophisticated computer-aided instruction systems monitor the
student’s performance over a period of time. The decision to begin a new
topic is often based on the student’s success with previous topics.
Modification #2: Modify the program to count the number of correct and
incorrect responses typed by the student. After the student types 10
answers, your program should calculate the percentage of correct
responses. If the percentage is lower than 75%, print “Please ask your
instructor for extra help” and reset the program.
Modification #3: Modify the program to allow the user to enter a
grade-level capability. A grade level of 1 means to use only
single-digit numbers in the problems, and a grade level of 2 means to
use numbers as large as two digits.
Modification #4: Modify the program to allow to user to pick the type of
arithmetic problems he or she wishes to study. An option of 1 means
addition problems only, 2 means subtraction problems only, 3 means
multiplication problems only, 4 means division problems only and 5 means
to intermix randomly problems of all these types
All help is very much appreciated.