Hi Im am basicly new to java and the these forums and i am having a problem here.
The thing is im still in high school and we started to learn java and we are doing a dice program and what we have to do is that we have to make it roll a pair of six sided die and we also have to make it count how much 1s, 2s, 3s, 4s, 5s, and 6s showed up out of said amount of rolls which is what i am having the problem with
heres my code:
import java.util.Random; public abstract class DiceRoll { public static void main(String[] args) { int Dice1 = 0; int Dice2 = 0; Random generator = new Random(); int counter = 0; int nOne = 0; int nTwo = 0; int nThree = 0; int nFour = 0; int nFive = 0; int nSix = 0; for(int i=0; i < 1200 ; i++) { Dice1 = (int)(Math.random()*6) + 1; Dice2 = (int)(Math.random()*6) + 1; } // end for System.out.println("There were " + nOne + " ones, " + nTwo + " twos, " + nThree + " threes, " + nFour + " fours, " + nFive + " fives, and, " + nSix + " sixs " + "were rolled out of "); } // end main } // end class DiceRoll
Thank you for help