202 Methods Chapter 6 using System.Collections; 6 using (Best web site)
202 Methods Chapter 6 using System.Collections; 6 using System.ComponentModel; 7 using System.Windows.Forms; 8 using System.Data; 9 public class RandomInt : System.Windows.Forms.Form 11 { 12 private System.Windows.Forms.Button showOutputButton; 13 private System.Windows.Forms.Label outputLabel; 14 // Visual Studio .NET generated code 16 17 // the main entry point for the application 18 [STAThread] 19 static void Main() { 21 Application.Run( new RandomInt() ); 22 } 23 24 private void showOutputButton_Click( object sender, System.EventArgs e ) 26 { 27 Random randomInteger = new Random(); 28 29 outputLabel.Text = “”; 31 // loop 20 times 32 for ( int counter = 1; counter <= 20; counter++ ) 33 { 34 // pick random integer between 1 and 6 int nextValue = randomInteger.Next( 1, 7 ); 36 37 outputLabel.Text += 38 nextValue + " "; // append value to output 39 // add newline after every 5 values 41 if ( counter % 5 == 0 ) 42 outputLabel.Text += "n"; 43 } 44 } } Fig. 6.9 Random integers in the range 1 6. (Part 2 of 2.)
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.