| | |
Help with Dice Simulation
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2008
Posts: 37
Reputation:
Solved Threads: 0
Hmmm... well, I'm getting an error on my code on the line
public static void main(String[] args)
and I checked all of my {'s. The error says "class, interface, or enum expected".
Any help appreciated...
public static void main(String[] args)
and I checked all of my {'s. The error says "class, interface, or enum expected".
Java Syntax (Toggle Plain Text)
public class Rolling { private random myDie; } public static void main(String[] args) { double seed = Math.random ( ) * 10; int seedInt = (int)seed; myDie = new Random (seedInt); int counter = 0; int dieRollOne; int dieRollTwo; int dieRollThree; do { dieRollOne = myDie.nextInt(6) + 1; dieRollTwo = myDie.nextInt(6) + 1; dieRollThree = myDie.nextInt(6) + 1; counter += 1; System.out.println(dieRollOne + " " + dieRollTwo + " " + dieRollThree); } while ((dieRollOne == dieRollTwo) || (dieRollOne == dieRollThree) || (dieRollTwo == dieRollThree)); if(!(dieRollOne == dieRollTwo) && !(dieRollOne == dieRollThree) && !(dieRollTwo == dieRollThree)); { System.out.println("Count = " + counter); } }
Any help appreciated...
This:
Should be:
Java Syntax (Toggle Plain Text)
public class Rolling { private random myDie; } public static void main(String[] args) { }
Should be:
Java Syntax (Toggle Plain Text)
public class Rolling { private random myDie; public static void main(String[] args) { } }
Check out my New Bike at my Public Profile at the "About Me" tab
![]() |
Similar Threads
- dice simulation (Python)
- Round Robin Scheduler (C)
- Need Help Printing Histogram Asterisks (Java)
Other Threads in the Java Forum
- Previous Thread: Solve My Question Pls....
- Next Thread: Need help with adt table
| Thread Tools | Search this Thread |
-xlint actionlistener android api applet application array arrays automation binary blackberry block bluetooth character chat class classes client code compile component consumer database desktop developmenthelp eclipse error event exception fractal ftp game gameprogramming givemetehcodez graphics gui html ide image input integer j2me j2seprojects java javac javaee javaprojects jmf jni jpanel julia lego linked linux list loop loops mac map method methods mobile netbeans newbie notdisplaying number online print printf problem program programming project properties recursion researchinmotion rotatetext rsa scanner screen server set singleton size sms sort sql string swing system template textfields threads time title tree tutorial-sample update windows working






