Structured programming and subroutines (procedures and functions)

EasyMediumHard
1234567891011121314
Question 2
Hard

Write a subroutine in C# called monitorErrors that will count the number of server error flags ('E') on a server network grid.

An example of the 2D array serverGrid is shown in Figure 1.

Figure 1

0123
0'O''O''E''O'
1'E''O''E''O'
2'O''E''O''E'

The subroutine should:

  • take the 2D array serverGrid of characters as a parameter
  • count the number of 'E' characters in the serverGrid array
  • output the phrase System Critical if there are eight or more 'E' symbols in the array
  • output the total number of 'E' symbols if there are fewer than eight 'E' symbols in the array.

You must write your own count routine and not use any built-in search or count functions that might be available in C#.

You should use meaningful variable name(s) and C# syntax in your answer.

[8]

Structured programming and subroutines (procedures and functions) Questions

  1. GCSE
  2. /Computer Science
  3. /Structured programming and subroutines (procedures and functions)