The issue with my program is that it does not calculate how many times the specific value has occurred. I believe that I have everything in place, but I'm not sure to as why it wouldn't work. Any help and/or feedback is kindly appreciated. Thanks!

Ok, so basically this program is supposed to do the following:

Modify the die program so it rolls both dice 500 times. Count the number of times each value occurred.
Your output should look like this:
2's = n times
3's = n times
.
.
12's = n times

class HowManyDoubles{
public static void main (String[] args){
  int die1, die2, times = 0, oneCount = 0, twoCount = 0, threeCount = 0, fourCount = 0, fiveCount = 0, sixCount = 0; 
  int sevenCount = 0, eightCount = 0, nineCount = 0;
  int countAmount = 0, diceAmount = 0;
  System.out.println ("Start rolling...");
  while (countAmount != 500 && diceAmount != 500) {
  die1 = (int)(Math.random()*6) + 1;
  System.out.println ("First die: " + die1); 
  diceAmount++;
  die2 = (int)(Math.random()*6) + 1; 
  System.out.println ("Second die: " + die2);
  countAmount++;
  }
  for (int count = 0; count <= diceAmount || count <= countAmount; count++) {
  switch (times) {
    case 1:
      oneCount += 1;
      break;
    case 2:
      twoCount += 1;
      break;
    case 3:
      threeCount += 1;
      break;
    case 4:
      fourCount += 1;
      break;
    case 5:
      fiveCount += 1;
      break;
    case 6:
      sixCount += 1;
      break;
    case 7:
      sevenCount += 1;
      break;
    case 8:
      eightCount += 1;
      break;
    case 9:
      nineCount += 1;
      break;
  }
  }
  System.out.println ("You rolled one's" + oneCount + " times.");
  System.out.println ("You rolled two's" + twoCount + " times.");
  System.out.println ("You rolled three's" + threeCount + " times.");
  System.out.println ("You rolled four's" + fourCount + " times.");
  System.out.println ("You rolled five's" + fiveCount + " times.");
  System.out.println ("You rolled six's" + sixCount + " times.");
  System.out.println ("You rolled seven's" + sevenCount + " times.");
  System.out.println ("You rolled eight's" + eightCount + " times.");
  System.out.println ("You rolled nine's" + nineCount + " times.");
}
}

Recommended Answers

All 30 Replies

I'm not sure to as why it wouldn't work

Are you getting errors? If so please post the full text of the messages.
Is the program output incorrect, if so please post the program's output, eplain what is wrong with it and show what the output should be.

Your code is very poorly formatted making it hard to read. Please edit your post and add indentations (3-4 spaces) to the code within {}s

Are you getting errors? If so please post the full text of the messages.
Is the program output incorrect, if so please post the program's output, eplain what is wrong with it and show what the output should be.

The output is incorrect, as it's not identifying how many times the value has occurred, and no there aren't any errors.

This is how it's being outputted:


Output:
> run HowManyDoubles
Start rolling...
First die: 3
Second die: 4
First die: 6
Second die: 4
First die: 3
Second die: 5
First die: 3
Second die: 6
First die: 1
Second die: 2
First die: 4
Second die: 2
First die: 5
Second die: 1
First die: 4
Second die: 1
First die: 3
Second die: 2
First die: 4
Second die: 2
First die: 1
Second die: 6
First die: 2
Second die: 5
First die: 1
Second die: 6
First die: 1
Second die: 1
First die: 4
Second die: 1
First die: 2
Second die: 1
First die: 3
Second die: 1
First die: 4
Second die: 1
First die: 5
Second die: 1
First die: 4
Second die: 5
First die: 2
Second die: 6
First die: 2
Second die: 4
You rolled one's 0 times.
You rolled two's 0 times.
You rolled three's 0 times.
You rolled four's 0 times.
You rolled five's 0 times.
You rolled six's 0 times.
You rolled seven's 0 times.
You rolled eight's 0 times.
You rolled nine's 0 times.
>

Your code is very poorly formatted making it hard to read. Please edit your post and add indentations (3-4 spaces) to the code within {}s

Sorry about that, but thanks for the feedback!
I can't seem to be able to edit my initial post, so I will post it again as a reply. Hope it's better!

class HowManyDoubles{



public static void main (String[] args){
  


int die1, die2, times = 0, oneCount = 0, twoCount = 0, threeCount = 0, fourCount = 0, fiveCount = 0, sixCount = 0; 
  int sevenCount = 0, eightCount = 0, nineCount = 0;
  int countAmount = 0, diceAmount = 0;
  System.out.println ("Start rolling...");
  while (countAmount != 500 && diceAmount != 500) {
  


die1 = (int)(Math.random()*6) + 1;
  System.out.println ("First die: " + die1); 
  diceAmount++;
  die2 = (int)(Math.random()*6) + 1; 
  System.out.println ("Second die: " + die2);
  countAmount++;
  }
  


for (int count = 0; count <= diceAmount || count <= countAmount; count++) {
  


switch (times) {
    


case 1:
      oneCount += 1;
      break;
    case 2:
      twoCount += 1;
      break;
    case 3:
      threeCount += 1;
      break;
    case 4:
      fourCount += 1;
      break;
    case 5:
      fiveCount += 1;
      break;
    case 6:
      sixCount += 1;
      break;
    case 7:
      sevenCount += 1;
      break;
    case 8:
      eightCount += 1;
      break;
    case 9:
      nineCount += 1;
      break;
  }
  }
  System.out.println ("You rolled one's " + oneCount + " times.");
  
  System.out.println ("You rolled two's " + twoCount + " times.");

  System.out.println ("You rolled three's " + threeCount + " times.");

  System.out.println ("You rolled four's " + fourCount + " times.");

  System.out.println ("You rolled five's " + fiveCount + " times.");

  System.out.println ("You rolled six's " + sixCount + " times.");

  System.out.println ("You rolled seven's " + sevenCount + " times.");

  System.out.println ("You rolled eight's " + eightCount + " times.");

  System.out.println ("You rolled nine's " + nineCount + " times.");
}
}

There was no need to post so many lines of print out. A few in the beginning and a few from the end. The rest should have been removed.

Can you describe the logic you are trying to implement in the code you have written?
I see more than one loop. What is each loop supposed to do?
Where do you change the value of the times variable used in the switch statement?

Your case statement is based on the integer TIMES. This value never changes and is always zero. Try making a method that increments the ncounts and call that passing die1 and die2 and you should be ok.

There was no need to post so many lines of print out. A few in the beginning and a few from the end. The rest should have been removed.

Can you describe the logic you are trying to implement in the code you have written?
I see more than one loop. What is each loop supposed to do?
Where do you change the value of the times variable used in the switch statement?

Logically, the program is to roll the dice 500 times, which it does perfectly, and then it is supposed to count how many times each value has occurred. For example, how many times the number 1, 2, 3, 4, etc have been rolled.

The loop below, is used to make both dice roll 500 times before stopping.

while (countAmount != 500 && diceAmount != 500) {

This second loop, below, is supposed to keep count of each value occurred for up to 500 rolls. The initial count being 0, and as the count is accumulated with the "count++", it would keep going up to 500.

for (int count = 0; count <= diceAmount || count <= countAmount; count++) {

Your case statement is based on the integer TIMES. This value never changes and is always zero. Try making a method that increments the ncounts and call that passing die1 and die2 and you should be ok.

I'm not sure what you exactly mean by that, as I have the counts for each number incrementing in each case. Could you help me further understand that, and thanks very much for your help!

the program is to roll the dice 500 times, which it does perfectly, and then it is supposed to count how many times each value has occurred.

How can it count the values if the counting is not done at the place where the numbers are available for counting? It should all be done in ONE loop.

How can it count the values if the counting is not done at the place where the numbers are available for counting? It should all be done in ONE loop.

Well, as you know I am VERY new at this, and so I may not know everything, nor do this in the correct order, but I'm still trying. Thanks for your help so far though! The answer to that question would simply be, that the first loop counts the dice rolls (500), whereas the second one is left open and is for the switch. If there is a way to do this in only one loop, then I apologise for that, since I haven't yet learned how to do that, nor have I seen it.

How can it count the values if the counting is not done at the place where the numbers are available for counting? It should all be done in ONE loop.

If you don't mind, could you kindly show as to how I could fix my program?

What actually happens in the second loop?
Add a

case 0:

to the switch statement and add a println in the code for that case to see what the value of the times variable is when the code is executed.

Don't post the output.

how I could fix my program?

Describe in pseudo code what you want the program to do.
Write some short statements in a list of what should happen.
Show how and when you get the numbers to be counted
and show when you count those numbers.

What actually happens in the second loop?
Add a

case 0:

to the switch statement and add a println in the code for that case to see what the value of the times variable is when the code is executed.

Don't post the output.

The value of the times variable prints out as 0.
It also prints out that I rolled one's 501 times.

Describe in pseudo code what you want the program to do.
Write some short statements in a list of what should happen.
Show how and when you get the numbers to be counted
and show when you count those numbers.

Haha, I'm sorry but I'm not sure of how to write my program in "pseudo code" format, but I can try to simply explain how this is supposed to be.

I already know that the rolling of the dice up to the amount of 500 is correct.
The next step in the program should be the counting of each variable on a die, for example the numbers to be counted are: 1, 2, 3, 4, 5, 6, 7, 8, 9.
At the end of the program, after the 500 rolls, it is to display how many times each variable occurred in the 500 rolls.

What actually happens in the second loop?
Add a

case 0:

to the switch statement and add a println in the code for that case to see what the value of the times variable is when the code is executed.

Don't post the output.

I understand that you're trying to say the issue resides in the switch variable TIMES remaining at 0, and I am not sure of how to overcome this issue. Also, about combining the loops into one loop, I am also not sure of how to do that.

What if you count the numbers in the same loop they are generated in?
It is permitted to do more than one thing in a loop:
begin the loop
Generate the numbers
Count the numbers
end the loop

Deleted

What if you count the numbers in the same loop they are generated in?
It is permitted to do more than one thing in a loop:
begin the loop
Generate the numbers
Count the numbers
end the loop

Ok, I get what your trying to say, but again, I'm not sure as to how I would form one loop to also count the numbers. Do you mind showing me?


EDIT: As I try changing the variable TIMES to accumulate it, as you had stated that was one of the issues, my program crashes.

To make one loop, remove statements 23 (the } ) and 27 (the for(... )

Here's another idea. Forget about a loop. Do everything only one time.
Generate the number, count it and print out the report.

JavaPrograms, as an idea, I would recommend you replace your switch case statement with if-elseif statements and I believe you'll see the problems times variable is giving you. otherwise, NormaR1 has helped you a lot. just take a break, and get back to your code after a few minutes.. and perhaps you'll figure it out

To make one loop, remove statements 23 (the } ) and 27 (the for(... )

As I tried this, it turned into an infinite loop.

Here's another idea. Forget about a loop. Do everything only one time.
Generate the number, count it and print out the report.

As I try taking out the loop which makes it roll 500 times, and re-organize it a bit to make it only roll once. I end up with a lot of errors, most residing as: "Cannot be resolved to a variable" for all of the counters.

Make sure the variables are defined somewhere.
What happened to all the variables defined on lines 9 to 11?


Post the new program and the error messages.

Make sure the variables are defined somewhere.
What happened to all the variables defined on lines 9 to 11?


Post the new program and the error messages.

The variables were defined at the top. The variables defined on lines 9 to 11 remained the same.

class HowManyDoublesA{
public static void main (String[] args){
  

while (true) {
  

int die1, die2, times = 1, oneCount = 0, twoCount = 0, threeCount = 0, fourCount = 0, fiveCount = 0, sixCount = 0; 
  int sevenCount = 0, eightCount = 0, nineCount = 0;
  int countAmount = 0, diceAmount = 0;
  System.out.println ("Start rolling...");
  die1 = (int)(Math.random()*6) + 1;
  System.out.println ("First die: " + die1); 
  diceAmount++;
  die2 = (int)(Math.random()*6) + 1; 
  System.out.println ("Second die: " + die2);
  countAmount++;
  }
  for (int count = 0; count <= diceAmount || count <= countAmount; count++) {
  


switch (times) {
    

case 1:
      oneCount += 1;
      break;
    case 2:
      twoCount += 1;
      break;
    case 3:
      threeCount += 1;
      break;
    case 4:
      fourCount += 1;
      break;
    case 5:
      fiveCount += 1;
      break;
    case 6:
      sixCount += 1;
      break;
    case 7:
      sevenCount += 1;
      break;
    case 8:
      eightCount += 1;
      break;
    case 9:
      nineCount += 1;
      break;
  }
  }
  System.out.println ("You rolled one's " + oneCount + " times.");
  
System.out.println ("You rolled two's " + twoCount + " times.");
  
System.out.println ("You rolled three's " + threeCount + " times.");
  
System.out.println ("You rolled four's " + fourCount + " times.");
 
 System.out.println ("You rolled five's " + fiveCount + " times.");
 
 System.out.println ("You rolled six's " + sixCount + " times.");
 
 System.out.println ("You rolled seven's " + sevenCount + " times.");
 
 System.out.println ("You rolled eight's " + eightCount + " times.");
 
 System.out.println ("You rolled nine's " + nineCount + " times.");
}
}

Error messages:


21 errors found:
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 22]
Error: diceAmount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 22]
Error: countAmount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 23]
Error: times cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 25]
Error: oneCount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 28]
Error: twoCount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 31]
Error: threeCount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 34]
Error: fourCount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 37]
Error: fiveCount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 40]
Error: sixCount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 43]
Error: sevenCount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 46]
Error: eightCount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 49]
Error: nineCount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 53]
Error: oneCount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 54]
Error: twoCount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 55]
Error: threeCount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 56]
Error: fourCount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 57]
Error: fiveCount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 58]
Error: sixCount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 59]
Error: sevenCount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 60]
Error: eightCount cannot be resolved to a variable
File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoublesA.java [line: 61]
Error: nineCount cannot be resolved to a variable

Okay. So the basic changes to your code are as follows:

Kept your first loop going through the entire program until you get just before printing the counts. I removed the second loop as this is where you problems were occurring.
I have changed the switch statement to work on die1 and added the exact same switch statement immediately after to work on die2.

This is a crude way of dealing with the situation. The switch statement could be made into a method and called once passing in die1 and then again passing in die2.

I have also initialised die1 and die2 as 0.

For your print statements you will never roll a 7,8 or 9 on a six sided die :)

Good luck!!!

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package howmanydoubles;

/**
 *
 * @author Bernie
 */
class HowManyDoubles {

    public static void main(String[] args) {



        int die1 = 0, die2 = 0, times = 0, oneCount = 0, twoCount = 0, threeCount = 0, fourCount = 0, fiveCount = 0, sixCount = 0;
        int sevenCount = 0, eightCount = 0, nineCount = 0;
        int countAmount = 0, diceAmount = 0;
        System.out.println("Start rolling...");
        while (countAmount != 500 && diceAmount != 500) {



            die1 = (int) (Math.random() * 6) + 1;
            System.out.println("First die: " + die1);
            diceAmount++;
            die2 = (int) (Math.random() * 6) + 1;
            System.out.println("Second die: " + die2);
            countAmount++;
        



      //  for (int count = 0; count <= diceAmount || count <= countAmount; count++) {



            switch (die1) {



                case 1:
                    oneCount += 1;
                    break;
                case 2:
                    twoCount += 1;
                    break;
                case 3:
                    threeCount += 1;
                    break;
                case 4:
                    fourCount += 1;
                    break;
                case 5:
                    fiveCount += 1;
                    break;
                case 6:
                    sixCount += 1;
                    break;
                case 7:
                    sevenCount += 1;
                    break;
                case 8:
                    eightCount += 1;
                    break;
                case 9:
                    nineCount += 1;
                    break;
            }
            switch (die2) {



                case 1:
                    oneCount += 1;
                    break;
                case 2:
                    twoCount += 1;
                    break;
                case 3:
                    threeCount += 1;
                    break;
                case 4:
                    fourCount += 1;
                    break;
                case 5:
                    fiveCount += 1;
                    break;
                case 6:
                    sixCount += 1;
                    break;
                case 7:
                    sevenCount += 1;
                    break;
                case 8:
                    eightCount += 1;
                    break;
                case 9:
                    nineCount += 1;
                    break;
            }
        //}
        }
        System.out.println("You rolled one's " + oneCount + " times.");

        System.out.println("You rolled two's " + twoCount + " times.");

        System.out.println("You rolled three's " + threeCount + " times.");

        System.out.println("You rolled four's " + fourCount + " times.");

        System.out.println("You rolled five's " + fiveCount + " times.");

        System.out.println("You rolled six's " + sixCount + " times.");

        System.out.println("You rolled seven's " + sevenCount + " times.");

        System.out.println("You rolled eight's " + eightCount + " times.");

        System.out.println("You rolled nine's " + nineCount + " times.");
    }
}
commented: Giving the OP code does not help him learn -3

JavaPrograms, as an idea, I would recommend you replace your switch case statement with if-elseif statements and I believe you'll see the problems times variable is giving you. otherwise, NormaR1 has helped you a lot. just take a break, and get back to your code after a few minutes.. and perhaps you'll figure it out

Right, as you had replied to change it from a switch case, into if-else if. Here is what the program looks like when changed into that, but 9 errors are found.

class HowManyDoubles{
public static void main (String[] args){
  while (true) {
  int die1, die2, oneCount = 0, twoCount = 0, threeCount = 0, fourCount = 0, fiveCount = 0, sixCount = 0; 
  int sevenCount = 0, eightCount = 0, nineCount = 0;
  int countAmount = 0, diceAmount = 0;
  System.out.println ("Start rolling...");
  while (countAmount != 500 && diceAmount != 500) {
  die1 = (int)(Math.random()*6) + 1;
  System.out.println ("First die: " + die1); 
  diceAmount++;
  die2 = (int)(Math.random()*6) + 1; 
  System.out.println ("Second die: " + die2);
  countAmount++;
  }
  if (die1 || die2 == 1) { 
    System.out.println ("You rolled one's " + oneCount + " times.");  
    oneCount += 1;
  }
  else if (die1 || die2 == 2) { 
    System.out.println ("You rolled two's " + twoCount + " times.");  
    twoCount += 1;
  }
  else if (die1 || die2 == 3) { 
    System.out.println ("You rolled three's " + threeCount + " times.");  
    threeCount += 1;
  }
  else if (die1 || die2 == 4) { 
    System.out.println ("You rolled four's " + fourCount + " times.");  
    fourCount += 1;
  } 
  else if (die1 || die2 == 5) { 
    System.out.println ("You rolled five's " + fiveCount + " times.");  
    fiveCount += 1;
  }
  else if (die1 || die2 == 6) {  
    System.out.println ("You rolled six's " + sixCount + " times.");  
    sixCount += 1;
  }
  else if (die1 || die2 == 7) {     
    System.out.println ("You rolled seven's " + sevenCount + " times.");   
    sevenCount += 1;
  }
  else if (die1 || die2 == 8) { 
    System.out.println ("You rolled eight's " + eightCount + " times.");  
    eightCount += 1;
  }
  else if (die1 || die2 == 9) { 
 System.out.println ("You rolled nines's " + nineCount + " times.");
    nineCount += 1;
  }
  }
  }
}

The errors are:


9 errors found:

File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoubles.java [line: 23]
Error: The operator || is undefined for the argument type(s) int, boolean

File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoubles.java [line: 27]
Error: The operator || is undefined for the argument type(s) int, boolean

File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoubles.java [line: 31]
Error: The operator || is undefined for the argument type(s) int, boolean

File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoubles.java [line: 35]
Error: The operator || is undefined for the argument type(s) int, boolean

File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoubles.java [line: 39]
Error: The operator || is undefined for the argument type(s) int, boolean

File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoubles.java [line: 43]
Error: The operator || is undefined for the argument type(s) int, boolean

File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoubles.java [line: 47]
Error: The operator || is undefined for the argument type(s) int, boolean

File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoubles.java [line: 51]
Error: The operator || is undefined for the argument type(s) int, boolean

File: D:\Unit 3 Data Type, Objects, Assignments\HowManyDoubles.java [line: 55]
Error: The operator || is undefined for the argument type(s) int, boolean

Okay. So the basic changes to your code are as follows:

Kept your first loop going through the entire program until you get just before printing the counts. I removed the second loop as this is where you problems were occurring.
I have changed the switch statement to work on die1 and added the exact same switch statement immediately after to work on die2.

This is a crude way of dealing with the situation. The switch statement could be made into a method and called once passing in die1 and then again passing in die2.

I have also initialised die1 and die2 as 0.

For your print statements you will never roll a 7,8 or 9 on a six sided die :)

Good luck!!!

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package howmanydoubles;

/**
 *
 * @author Bernie
 */
class HowManyDoubles {

    public static void main(String[] args) {



        int die1 = 0, die2 = 0, times = 0, oneCount = 0, twoCount = 0, threeCount = 0, fourCount = 0, fiveCount = 0, sixCount = 0;
        int sevenCount = 0, eightCount = 0, nineCount = 0;
        int countAmount = 0, diceAmount = 0;
        System.out.println("Start rolling...");
        while (countAmount != 500 && diceAmount != 500) {



            die1 = (int) (Math.random() * 6) + 1;
            System.out.println("First die: " + die1);
            diceAmount++;
            die2 = (int) (Math.random() * 6) + 1;
            System.out.println("Second die: " + die2);
            countAmount++;
        



      //  for (int count = 0; count <= diceAmount || count <= countAmount; count++) {



            switch (die1) {



                case 1:
                    oneCount += 1;
                    break;
                case 2:
                    twoCount += 1;
                    break;
                case 3:
                    threeCount += 1;
                    break;
                case 4:
                    fourCount += 1;
                    break;
                case 5:
                    fiveCount += 1;
                    break;
                case 6:
                    sixCount += 1;
                    break;
                case 7:
                    sevenCount += 1;
                    break;
                case 8:
                    eightCount += 1;
                    break;
                case 9:
                    nineCount += 1;
                    break;
            }
            switch (die2) {



                case 1:
                    oneCount += 1;
                    break;
                case 2:
                    twoCount += 1;
                    break;
                case 3:
                    threeCount += 1;
                    break;
                case 4:
                    fourCount += 1;
                    break;
                case 5:
                    fiveCount += 1;
                    break;
                case 6:
                    sixCount += 1;
                    break;
                case 7:
                    sevenCount += 1;
                    break;
                case 8:
                    eightCount += 1;
                    break;
                case 9:
                    nineCount += 1;
                    break;
            }
        //}
        }
        System.out.println("You rolled one's " + oneCount + " times.");

        System.out.println("You rolled two's " + twoCount + " times.");

        System.out.println("You rolled three's " + threeCount + " times.");

        System.out.println("You rolled four's " + fourCount + " times.");

        System.out.println("You rolled five's " + fiveCount + " times.");

        System.out.println("You rolled six's " + sixCount + " times.");

        System.out.println("You rolled seven's " + sevenCount + " times.");

        System.out.println("You rolled eight's " + eightCount + " times.");

        System.out.println("You rolled nine's " + nineCount + " times.");
    }
}

Haha, yup you'd never roll a 7, 8, 9 on a six sided die, I'm not sure why I put that there, probably wasn't thinking. Thanks very much! It worked!

Also, thanks to everyone who was helping!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.