hi just have a question to make sure i understand it. i'm doing the exercises in my book and it says i should create a program which will roll 2 dice and produce a random number then adds the sum of the outcomes.
public class RollDice
{
/* This program simulates rolling a pair of dice.
The number that comes up on each die is output,
followed by the total of the two dice.
*/
public static void main (String[] args)
{
int die1; //The number on the first die.
int die2; //The number on the second die.
int roll; //The total roll (sum of the two dice).
die1 = (int) (Math.random() *6) + 1;
die2 = (int) (Math.random() *6) + 1;
roll = die1 + die2;
System.out.println("The first die comes up " + die1);
System.out.println("The second die comes up " + die2);
System.out.println("Your total roll is " + roll);
} //end man()
} //end of class
now this is all okay but when i remove the +1
there isnt any difference. i just want to know if removing the +1 will cause any problem on the program. if not...how about if i'm writing a longer program, will there be any implication?
Thanks