Hey guys. I just signed up and was hoping someone could help me out here. So for this program that's an assignment for my CS 1410 class.There's 2 dices and im suppose to do 1 million rolls. The program is suppose to calculate percentage of how many times the following things occur:
1. Each die has a value of one (Snake Eyes)
2. Each die has the same value (Doubles)
3. The sum of the two dice is seven (Sevens)
The output should look something like this:
------------------------------------------------
Snake eyes occurred x.xxxx percent of the time.
Doubles occurred x.xxxx percent of the time.
Sevens occurred x.xxxx percent of the time.
------------------------------------------------
I just need some guidance on the calculation and displaying the output. Any advice and support related to this is appreciated!
Ok so here's what I have so far:
import java.util.Scanner;
import java.util.Random;
public class DiceExperiment
{
public static void main(String[] argv)
{
int Dice_1 = 0;
int Dice_2 = 0;
int Dice_Rolls = 0;
double Snake_Eyes_Counter = 0.0;
double Doubles_Counter = 0.0;
double Sevens_Counter = 0.0;
Random generator1 = new Random();
int r = generator1.nextInt(6)+1;
while (Dice_Rolls <= 1000000)
{
}
System.out.println("Snake eyes occured: ");
System.out.println("Doubles occured: ");
System.out.println("Sevens occured: ");
}
}