Project 2 – Addendum

 

 

1. Because of some issues Java has with generating random numbers, the code I gave you for rollDie() only partially works. Use this skeleton instead:

 

class <YOUR CLASS NAME HERE>  {

            public static void main(String[] args)  {

                        //WRITE YOUR CODE HERE

            }

 

            static java.util.Random r = new java.util.Random();

 

            public static int rollDie() {

                        return r.nextInt(6) + 1;

            }

}

 

 

 

2. Because of the poor way that Console.in.readChar() behaves, I suggest not doing any sort of character input. Have the player enter the word “quit” to quit, and anything else, including nothing, to keep playing.

 

 

Sorry for the confusion.