Web server extensions - Chapter 6 Methods 209 48 else 49 if(
Chapter 6 Methods 209 48 else 49 if( sum == 7 ) 50 { 51 statusLabel.Text = “Sorry. You lose.”; 52 rollButton.Enabled = false; 53 playButton.Enabled = true; 54 } 55 56 } // end rollButton_Click 57 58 // simulate first roll and result of that roll 59 protected void playButton_Click( 60 object sender, System.EventArgs e ) 61 { 62 pointGroupBox.Text = “Point”; 63 statusLabel.Text = “”; 64 pointFirstDieImage.Image = null; 65 pointSecondDieImage.Image = null; 66 67 myPoint = 0; 68 int sum = rollDice(); 69 70 switch ( sum ) 71 { 72 case 7: 73 case ( int ) DiceNames.YO_LEVEN: 74 rollButton.Enabled = false; // disable Roll button 75 statusLabel.Text = “You Win!!!”; 76 break; 77 78 case ( int ) DiceNames.SNAKE_EYES: 79 case ( int ) DiceNames.TREY: 80 case ( int ) DiceNames.BOX_CARS: 81 rollButton.Enabled = false; 82 statusLabel.Text = “Sorry. You lose.”; 83 break; 84 85 default: 86 myPoint = sum; 87 pointGroupBox.Text = “Point is ” + sum; 88 statusLabel.Text = “Roll Again”; 89 displayDie( pointFirstDieImage, myDie1 ); 90 displayDie( pointSecondDieImage, myDie2 ); 91 playButton.Enabled = false; 92 rollButton.Enabled = true; 93 break; 94 95 } // end switch 96 97 } // end playButton_Click 98 Fig. 6.12 Program to simulate the game of craps. (Part 2 of 4.)
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.