Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // don't forget comments here..
- public class PigDice {
- public static void main(String[] args) {
- // create a Random number object
- // create a integer variable called totalScore
- // create six integer variables for each dice
- // print out a welcome message
- // generate the random number between for 1 and 6 for each die
- // check if any of the dice are 1
- if (die == 1 || die2 == 1 || die3 == 1 || die4 == 1 || die5 == 1
- || die6 == 1) {
- // print out a message that they recieved no score
- } else {
- // add all the dice up and add it to the totalScore
- // print out the individual values from the dice
- // print out a total score
- // check to see if they have won the game
- if (totalScore > 20) {
- // print out a message that indicates that they have won
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment