206 Methods Chapter 6 53 DisplayDie( (Domain and web hosting) dieLabel11 );

206 Methods Chapter 6 53 DisplayDie( dieLabel11 ); 54 DisplayDie( dieLabel12 ); 55 56 double total = ones + twos + threes + fours + fives + sixes; 57 58 // display the current frequency values 59 displayTextBox.Text = “FacettFrequencytPercentn1tt” + 60 ones + “tt” + 61 String.Format( “{0:F2}”, ones / total * 100 ) + 62 “%n2tt” + twos + “tt” + 63 String.Format( “{0:F2}”, twos / total * 100 ) + 64 “%n3tt” + threes + “tt” + 65 String.Format( “{0:F2}”, threes / total * 100 ) + 66 “%n4tt” + fours + “tt” + 67 String.Format( “{0:F2}”, fours / total * 100 ) + 68 “%n5tt” + fives + “tt” + 69 String.Format( “{0:F2}”, fives / total * 100 ) + 70 “%n6tt” + sixes + “tt” + 71 String.Format( “{0:F2}”, sixes / total * 100 ) + “%”; 72 73 } // end rollButton_Click 74 75 // display the current die, and modify frequency values 76 public void DisplayDie( Label dieLabel ) 77 { 78 int face = randomNumber.Next( 1, 7 ); 79 80 dieLabel.Image = Image.FromFile( 81 Directory.GetCurrentDirectory() + 82 “\images\die” + face + “.gif” ); 83 84 // add one to frequency of current face 85 switch ( face ) 86 { 87 case 1: 88 ones++; 89 break; 90 91 case 2: 92 twos++; 93 break; 94 95 case 3: 96 threes++; 97 break; 98 99 case 4: 100 fours++; 101 break; 102 103 case 5: 104 fives++; 105 break; Fig. 6.11 Simulating rolling 12 six-sided dice. (Part 2 of 3.)
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.

Leave a Reply