192 Methods Chapter 6 188 static void Main()
192 Methods Chapter 6 188 static void Main() 189 { 190 Application.Run(new MaximumValue()); 191 } 192 193 // Method Maximum uses method Math.Max to determine the 194 // maximum value among the three double arguments 195 double Maximum( double x, double y, double z ) 196 { 197 return Math.Max( x, Math.Max( y, z ) ); 198 } 199 200 // get the floating-point values that the user entered and 201 // invoke method Maximum to determine the maximum value 202 private void calculateButton_Click( object sender, 203 System.EventArgs e ) 204 { 205 // get inputted values and convert strings to doubles 206 double number1 = 207 Double.Parse( firstNumberTextBox.Text ); 208 209 double number2 = 210 Double.Parse( secondNumberTextBox.Text ); 211 212 double number3 = 213 Double.Parse( thirdNumberTextBox.Text ); 214 215 // invoke method Maximum to determine the largest value 216 double maximum = Maximum( number1, number2, number3 ); 217 218 // display maximum value 219 maximumLabel.Text = “maximum is: ” + maximum; 220 221 } // end method calculateButton_Click 222 223 } // end class MaximumValue 224 225 } // end namespace MaximumValue Fig. 6.4 Programmer-defined Maximum method. (Part 5 of 5.)
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.