
Access over 20 million homework documents through the notebank

Get on-demand Q&A homework help from verified tutors

Read 1000s of rich book guides covering popular titles
I’m studying for my Programming class and need an explanation.
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 Author: Ryroan Date: January 21st 2013 */ import javax.swing.*; public class Summative2 {What The Mods need to be:
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); } }
This question has not been answered.
Create a free account to get help with this and any other question!
Brown University
1271 Tutors
California Institute of Technology
2131 Tutors
Carnegie Mellon University
982 Tutors
Columbia University
1256 Tutors
Dartmouth University
2113 Tutors
Emory University
2279 Tutors
Harvard University
599 Tutors
Massachusetts Institute of Technology
2319 Tutors
New York University
1645 Tutors
Notre Dam University
1911 Tutors
Oklahoma University
2122 Tutors
Pennsylvania State University
932 Tutors
Princeton University
1211 Tutors
Stanford University
983 Tutors
University of California
1282 Tutors
Oxford University
123 Tutors
Yale University
2325 Tutors