Structured programming and subroutines (procedures and functions)

EasyMediumHard
1234567891011121314
Question 8
Hard

Write a subroutine in C# called analyzeHotspots that will count the number of hotspot symbols ('H') on a thermal sensor grid.

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

Figure 1 thermalGrid

The subroutine should:

  • take the 2D array thermalGrid of characters as a parameter
  • count the number of 'H' characters in the thermalGrid array
  • output the warning CRITICAL OVERHEAT if there are eight or more 'H' symbols in the array
  • output the total number of 'H' symbols if there are fewer than eight 'H' 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)