Skip to main content
added 20 characters in body
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

I'm a little hesitant about this partmessage printed in dieArray()'s loop:

while (numDice <= 0){
    System.out.println("Sorry, you must enter a positive number.");
    numDice = getInt(keyboard, "How many dice do you want to throw? ");
}

It seems more fitting to print something like this:

Sorry, you must throw at least one die

System.out.println("Sorry, you must throw at least one die.");

This makes it sound (at least to me) less like a mathematical program and more like a game.

In addition, you could consider setting an upper limit to the number of dice that can be thrown, in case the user strangely(strangely) inputs a huge number (which I assume can also break other code). You

You could then present the user with a message like this:

Sorry, you cannot throw that many dice

System.out.println("Sorry, you cannot throw that many dice.");

I'm a little hesitant about this part:

while (numDice <= 0){
    System.out.println("Sorry, you must enter a positive number.");
    numDice = getInt(keyboard, "How many dice do you want to throw? ");
}

It seems more fitting to print something like:

Sorry, you must throw at least one die

This makes it sound (at least to me) less like a mathematical program and more like a game.

In addition, you could consider setting an upper limit, in case the user strangely inputs a huge number (which I assume can break other code). You could then present the user with a message like this:

Sorry, you cannot throw that many dice

I'm a little hesitant about this message printed in dieArray()'s loop:

System.out.println("Sorry, you must enter a positive number.");

It seems more fitting to print something like this:

System.out.println("Sorry, you must throw at least one die.");

This makes it sound (at least to me) less like a mathematical program and more like a game.

In addition, you could consider setting an upper limit to the number of dice that can be thrown, in case the user (strangely) inputs a huge number (which I assume can also break other code).

You could then present the user with a message like this:

System.out.println("Sorry, you cannot throw that many dice.");
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

I'm a little hesitant about this part:

while (numDice <= 0){
    System.out.println("Sorry, you must enter a positive number.");
    numDice = getInt(keyboard, "How many dice do you want to throw? ");
}

It seems more fitting to print something like:

Sorry, you must throw at least one die

This makes it sound (at least to me) less like a mathematical program and more like a game.

In addition, you could consider setting an upper limit, in case the user strangely inputs a huge number (which I assume can break other code). You could then present the user with a message like this:

Sorry, you cannot throw that many dice