The code performs one overall task: compute the mean of all scores in the class, and set the color each seat according to its value.

The operation is broken down into these steps:

Examine each text box in the classroom, and:

collect its current value

convert the value to an integer

assign the value to the corresponding element in the 2-D ‘scores’ array

add the value to a ‘total ‘score variable

Divide the ‘total’ of the scores by the number of seats to obtain the mean

Display mean score value on the screen in  output text box

Visit each text box in the classroom, and

Determine the proper color for the seat based on its value and calculated mean:

If less than mean, color is red

If between mean and 90%, color is yellow

If greater than 90%, color is green

 Set background color of seat textbox to the proper color

 Note: The ‘Tag’ property of each seat’s textbox was set to string “Seat<r><c>” at design time (manually), to reflect the row/column position of the seat. This allows us to tell seats apart and relate them to row/column positions in the 2-D scores array. The FindBox() method implements this functionality.

 

 

    • 11 years ago
    A+ Work
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      gsfilet27.docx