Can someone please help me fix this program. its missing the closing screen but i didnt want to put it in since i was getting so many errors. It doesn't compile and it doesn't accomplish what its suppose to do, please help.
Task
1. Present Opening Screen
2. While user wants to play, Get user's guess
3. Generate random number
4. Compare guess with computer's number
5. Add 1 to counter if correct
6. Add 1 to games played in any case
7. Display prompt to continue.
8. If yes, then get number from user
9. If no, display results screen.
Methods Needed
1. Opening screen
2. Get user input for numbers
3. Generate random number
4. Get user response to continue
5. Display results
1. Random Numbers
2. Methods that return a value
3. Create a new Die class
import javax.swing.*; public class Lab2c { static int wins = 0; static int losses = 0; static int totalPlays = 0; public static void main(String args[]) { runIt(); System.exit(0); } public static void runIt () { int userNum; int compNum; int value; openingMessage(); do { userNum = getInt(); compNum = rollTheDice(); CompareNum (userNum, compNum); value = JOptionPane.showConfirmDialog(null, "Continue with the game?"); } while (value == JOptionPane.YES_OPTION); // do while } public static void endingMessage() { String message1; String message2; String finalmessage; message1 = "Thanks for playing"; message2 = "You have won" + wins + "You Played" + "games"; } public static void compareNum (int user, int comp) { if(user == comp) { s = JOptionPane.showMessageDialog (null, "You Win"); wins++; totalPlays++; System.out.println ("Wins:" + wins); } else { s = JOptionPane.showMessageDialog (null, "You Lost"); totalPlays++; } } public static void openingMessage() { String openingMessage = ""; openingMessage = "Welcome to the Guess the Numbers from 1 to 6 Program \n\n" // change my Message to + "The computer will generate a random number from 1 to 6. \n" // your Message for your program. + "Your task is to see if you can guess the number.\n \n" + "The game will keep track of how many games you played \n" + "and it will tell you how many wins you had \n \n" + "\tClick OK to Begin.\n\n\tGood Luck \n"; JTextArea outputArea = new JTextArea(15,30); // create an Instance of a JTextArea - in this case the variable name is outputArea outputArea.setText ( openingMessage ); // put the Text String into the outputArea JOptionPane.showMessageDialog ( null, outputArea, // Display the Message "Opening Screen for Game 1 to 6", // Create a suitable Title for the Window JOptionPane.INFORMATION_MESSAGE ); } public static void dice() { int Total; String output = ""; //collect from user guess of //die total with method guesTheDice(make if statement for not to break if val<= 1 && <=6 Total = guessTheDice(); int rolledTotal; //roll the dice in method rolledTotal = rollTheDice(); if(Total == rolledTotal) output = "You guessed right!" + " The dice total is " + Total; else output = "Sorry. The dice total is: " +rolledTotal; JOptionPane.showMessageDialog( null, output); System.exit(0); }//end main public static int guessTheDice () { int dice1; //first value of die1 int total; String firstDice; fir } { int x; x = getInt (); System.out.println ("You entered " + x + "."); } // main public static int getInt() { int val; while (true) // a seemingly endless loop - uses break to get out 7 { String s = JOptionPane.showInputDialog ( "Enter a number from 1 - 6:" ); if (s == null) { JOptionPane.showMessageDialog(null, "Leaving program"); // exit on cancel System.exit (0); } // cancel if else if (s.equals("")) { JOptionPane.showMessageDialog (null, "You must make an entry in the InputBox"); } // entered nothing try 8 { val = Integer.parseInt(s); if (val = 0) break; // exit loop with valid in // could have had a variable change here to get out of loop