A developer is writing a stock control system. The system uses a 3 x 3 grid containing nine storage bays.
In the program, a storage bay is referred to by a letter and a number. For example, bay N3 in Figure 1 contains an item marked with X.
Figure 2 shows part of a C# program that checks the bay reference entered by a user.
The bay reference is valid if:
Figure 1
| L | M | N | |
|---|---|---|---|
| 1 | |||
| 2 | |||
| 3 | X |
Figure 2
bool check = false;
while (check == false) {
string bay = "";
while (bay.Length != 2) {
Console.Write("Enter storage bay (e.g. M2): ");
bay = Console.ReadLine();
bay = bay.ToUpper();
}
}
Extend the program from Figure 2 so it completes the other checks needed to make sure a valid bay reference is entered.
Your extended program must:
checkYou should use meaningful variable name(s) and C# syntax in your answer.