Write a subroutine in VB.Net called checkHazards that counts the number of hazardous material containers in a shipping yard grid.
The shipping yard is represented as a 4x4 2D array of strings, where hazardous containers are represented by the string "H".
An example of the yard array is shown in Table 1 below:
Table 1
| 0 | 1 | 2 | 3 | |
|---|---|---|---|---|
| 0 | Cargo | H | Cargo | Empty |
| 1 | Empty | Cargo | H | Cargo |
| 2 | Cargo | Cargo | Empty | Empty |
| 3 | H | Cargo | Cargo | H |
Safety protocols require you to identify if the yard has a dangerous accumulation of hazards.
The subroutine should:
yard as a parameter"H" elements in the array"Danger" if there are three or more "H" elements in the array"H" elements if there are fewer than three.You must write your own counting routine utilizing nested loops and not use any built-in search or counting functions that might be available in VB.Net. You can assume the nested loops will iterate over a fixed 4x4 grid.
You should use meaningful variable names and correct VB.Net syntax in your answer.