Cedant web hosting - Chapter 7 Arrays 271 53 54 outputLabel.Text +=
Chapter 7 Arrays 271 53 54 outputLabel.Text += “nnLowest grade: ” + Minimum() + 55 “nHighest grade: ” + Maximum() + “n”; 56 57 for ( int i = 0; i < students; i++ ) 58 outputLabel.Text += "nAverage for student " + i + " is " + 59 Average( grades[ i ] ); 60 61 } // end method showOutputButton_Click 62 63 // find minimum grade in grades array 64 public int Minimum() 65 { 66 int lowGrade = 100; 67 68 for ( int i = 0; i < students; i++ ) 69 70 for ( int j = 0; j < exams; j++ ) 71 72 if ( grades[ i ][ j ] < lowGrade ) 73 lowGrade = grades[ i ][ j ]; 74 75 return lowGrade; 76 } 77 78 // find maximum grade in grades array 79 public int Maximum() 80 { 81 int highGrade = 0; 82 83 for ( int i = 0; i < students; i++ ) 84 85 for ( int j = 0; j < exams; j++ ) 86 87 if ( grades[ i ][ j ] > highGrade ) 88 highGrade = grades[ i ][ j ]; 89 90 return highGrade; 91 } 92 93 // determine average grade for a particular student 94 public double Average( int[] setOfGrades ) 95 { 96 int total = 0; 97 98 for ( int i = 0; i < setOfGrades.Length; i++ ) 99 total += setOfGrades[ i ]; 100 101 return ( double ) total / setOfGrades.Length; 102 } 103 104 } // end class DoubleArray Fig. 7.15 Example using double-subscripted arrays. (Part 2 of 3.)
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.