1. [15 marks] Write a new method that will work as the menu of your application. Details:
2. [25 marks] In your Main method, using a “while” loop, not a “do while”, write the code to call the Menu method you have created on question #1 repeatedly.
Using a “switch” structure, write the code to implement the following required functionality for all valid responses. Valid responses includes both upper and lower case of the input. The following must be implemented:
- A will call the DemoQuestion3() method
- B will call the DemoQuestion4() method
- C will call the DemoQuestion5() method
- X will terminate the program
Any other
class Program
{
static void Main(string[] args)
{
SamMenu();
while (true)
{
Console.Write("Input the option (A, B, C, X): ");
string input = Console.ReadLine().ToUpper();
switch (input)
{
case "A":
DemoQuestion3();
break;
case "B":
DemoQuestion4();
break;
case "C":
DemoQuestion5();
break;
case "X":
Console.WriteLine("Press any key to close app..");
Console.ReadLine();
return;
default:
Console.WriteLine("Incorrect input!");
break;
}
}
}
public static void DemoQuestion3()
{
}
public static void DemoQuestion4()
{
}
public static void DemoQuestion5()
{
}
public static void SamMenu()
{
Console.WriteLine("Display my menu...");
}
}
Comments
Leave a comment