Ryroan
2013-01-21 13:08:27 UTC
The I am Attempting to Make:
/* Name: Math.Random Mods
Author: Ryroan
Date: January 21st 2013 */
import javax.swing.*;
public class Summative2
{
public static void main (String args[])
{
int value;
int value2,Answer;
int value3;
int value4;
int counter;
int input;
String word;
String word2;
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);
do
{
output = value + " * " + value2;
output1 = JOptionPane.showInputDialog ("What is " + output + "?");
input = Integer.parseInt (output1);
Answer = value*value2;
value3 = 1 + (int) (Math.random() * 4);
{
switch(value3)
{
case 1:
word = "Awesome";
break;
case 2:
word = "Perfect";
break;
case 3:
word = "Flawless";
break;
case 4:
word = "YOU'RE UNSTOPPABLE";
break;
default:
break;
}
}
value4 = 1 + (int) (Math.random() * 3);
{
switch(value4)
{
case 1:
word2 = "Try Again";
break;
case 2:
word2 = "Sorry";
break;
case 3:
word2 = "Don't give up.";
break;
case 4:
word2 = "Durrrrrr";
break;
default:
break;
}
}
if (input != Answer)
JOptionPane.showMessageDialog (null, "NOPE", "FAIL", JOptionPane.ERROR_MESSAGE);
else
JOptionPane.showMessageDialog (null, "CORRECT", "PASS", JOptionPane.INFORMATION_MESSAGE);
}
while (input != Answer);
}
System.exit (0);
}
}
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
Very good!
Excellent!
Nice work!
Keep up the good work!
Responses to an incorrect answer
No. Please try again.
Wrong. Try once more.
Don’t give up.
Durrrrrr.
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.