This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I'm trying to write my own Craps game. It is very limited, just to help me get the idea of control structures within java. I tried using nested ifs, but failed to do it properly because in my crap game, the 2nd and 3rd rolls still occur regardless if the player wins in the first rolls, second, or third.
My second attempt was trying to seperate the stuff using switch and using a while control loop. I would appreciate any help on the first attempt and suggestions for improving my second attempt.
Thanks, Philip Herzer [ September 23, 2004: Message edited by: Philip Herzer ]
"Mejor morir de pie que vivir toda la vida arrodillas."<br /> Emilio Zapata
In both cases you do not have an proper exit to your program. Use: to exit the program after a game is complete. Your second version of the method rollDice, it should probably be renamed rollAndTallyTwoDice, because this will produce self-documenting code. The second version of the program has an int rollCounter but doesn't use it. I would use the rollCounter to limit the number of rolls that a player can have and I would also keep a record of the players status, along the lines of: