Hi, can you please help me debug my program? I need it to stimulate dices rolling but I am getting errors: Exception in thread "main" java.lang.Error: Unresolved compilation problems: Syntax error,...


Hi, can you please help me debug my program? I need it to stimulate dices rolling but I am getting errors:


Exception in thread "main" java.lang.Error: Unresolved compilation problems:

Syntax error, insert "else Statement" to complete IfStatement

Syntax error, insert "else Statement" to complete IfStatement

Syntax error, insert "}" to complete Block

Syntax error, insert "}" to complete Block

Syntax error, insert "}" to complete MethodBody


at DiceSimulation.main(DiceSimulation.java:108)



Here is my code:


import java.util.Random;   // Needed for the Random class



/**


   This class simulates rolling a pair of dice 10,000 times


   and counts the number of times doubles of are rolled for


   each different pair of doubles.


*/



public class DiceSimulation


{


   public static void main(String[] args)


   {


      final int NUMBER = 10000;  // Number of dice rolls



      // A random number generator used in


      // simulating the rolling of dice


      Random generator = new Random();



      int die1Value;       // Value of the first die


      int die2Value;       // Value of the second die


      int count = 0;       // Total number of dice rolls


      int snakeEyes = 0;   // Number of snake eyes rolls


      int twos = 0;        // Number of double two rolls


      int threes = 0;      // Number of double three rolls


      int fours = 0;       // Number of double four rolls


      int fives = 0;       // Number of double five rolls


      int sixes = 0;       // Number of double six rolls



      while(count <>


     for (count = 0; count <>


      {


      die1Value = generator.nextInt(6)+1;


      die2Value = generator.nextInt(6)+1;



      count = snakeEyes;



       if (die1Value == die2Value);


      {


      if(die1Value == 1)


      {


      snakeEyes = 1;}


      else if (die1Value == 1)


      {


      snakeEyes = 2;}


      else if (die1Value == 2)


      {


      snakeEyes = 3;}


      else if (die1Value == 3)


      {


      snakeEyes = 4;}


      else if (die1Value == 4)


      {


      snakeEyes = 5;}


      else if (die1Value == 5)


      {


      snakeEyes = 6;}


      else if (die1Value == 6)



      if (die2Value == die1Value)


      {


      count++;


      while(count <>


      {


      if(die2Value == 1)


  {


  snakeEyes=1;}


  elseif(die2Value==1)


  {


  snakeEyes=2;}


  elseif(die2Value==2)


  {


  snakeEyes=3;}


  elseif(die2Value==3)


  {


  snakeEyes=4;}


  elseif(die2Value==4)


  {


  snakeEyes=5;}


  elseif(die2Value==5)


  {


  snakeEyes=6;}


  elseif(die2Value==6)



      {


      count++;


      }


      // Display the results


      System.
out
.println ("You rolled snake eyes " +


                          snakeEyes + " out of " +


                          count + " rolls.");


      System.
out
.println ("You rolled double twos " +


                          twos + " out of " + count +


                          " rolls.");


      System.
out
.println ("You rolled double threes " +


                          threes + " out of " + count +


                          " rolls.");


      System.
out
.println ("You rolled double fours " +


                          fours + " out of " + count +


                          " rolls.");


      System.
out
.println ("You rolled double fives " +


                          fives + " out of " + count +


                          " rolls.");


      System.
out
.println ("You rolled double sixes " +


                          sixes + " out of " + count +


                          " rolls.");


      }


 }


Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here