Chapter 6 (How to cite a web site) Methods 207 106 107 case 6:
Chapter 6 Methods 207 106 107 case 6: 108 sixes++; 109 break; 110 111 } // end switch 112 113 } // end DisplayDie 114 115 // main entry point for the application 116 [STAThread] 117 static void Main() 118 { 119 Application.Run( new RollDie2() ); 120 } 121 122 } // end of class RollDie2 Fig. 6.11 Simulating rolling 12 six-sided dice. (Part 3 of 3.) As the program output demonstrates, over a large number of die rolls, each of the possible faces from 1 through 6 appears with approximately equal likelihood (i.e., about one- sixth of the time). After studying arrays in Chapter 7, Arrays, we will show how to replace the entire switch structure in this program with a single-line statement. 6.11 Example: Game of Chance One of the most popular games of chance is a dice game known as craps, played in casinos and back alleys throughout the world. The rules of the game are straightforward: A player rolls two dice. Each die has six faces. Each face contains 1, 2, 3, 4, 5 or 6 spots. After the dice have come to rest, the sum of the spots on the two upward faces is calculated. If the sum is 7 or 11 on the first throw, the player wins. If the sum is 2, 3 or 12 on the first throw (called craps ), the player loses (i.e., the house wins). If the sum is 4, 5, 6, 8, 9 or 10 on the first throw, that sum becomes the player s point. To win, players must continue rolling the dice until they make their point (i.e., roll their point value). The player loses by rolling a 7 before making the point. Figure 6.12 simulates the game of craps with a simple graphical user interface.
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.