static void Main(string[] args) { Builder.Build(); // Build all of the list. BuildPlayer.BuildAPlayer(); bool exit = false; string[] Weapons = { "EnergySword", "PlasmaBow", "ProtonPistol", "DecoyGrenade" }; string[] Potions = { "HealthPotion", "StaminaPotion" }; string[] Treasure = { "Credits", "Titanium", "Electronic Parts" }; List <string> Items = new List <string>() { "Map", "Armor", "Plasma Arrows", "Proton Bullets" }; DisplayCurrentRoom.CurrentRoom(); do { Console.Write(StandardMessages.DisplayMenu()); //Taking the user's choice and passing it through a switch statement. Using console.readline for the argument. switch (Console.ReadLine()) { case "1": break; case "2": Console.WriteLine(StandardMessages.PromptForMovement()); GameAction.PlayerActions(Console.ReadLine(), Player._player); break; case "3": Console.WriteLine(StandardMessages.PromptForAttack()); GameAction.PlayerActions(Console.ReadLine(), Player._player); break; case "4": Console.WriteLine(StandardMessages.AdminCenter()); Create.PromptForCreation(); break; case "5": //Exit the program --> Set the boolean variable to true and display goodbye message. Console.WriteLine(StandardMessages.DisplayGoodbye()); Console.ReadLine(); exit = true; break; default: //Call number error message for incorrect menu choice. Console.WriteLine(StandardMessages.DisplayNumberError()); Console.ReadLine(); break; } } while (exit == false); }
static void Main(string[] args) { // Create variable for user input and sentry for loop bool exit = false; List <Employee> employees = new List <Employee>(); // Do while loop for menu do { Console.Write(StandardMessages.DisplayMenu()); // Switch to direct to proper process switch (Console.ReadLine()) { case "1": BuildEmployees.BuildEmployeeClassObjects(employees); Console.WriteLine(""); Console.WriteLine(StandardMessages.DisplayEmployee(employees[employees.Count - 1])); //WL in the create employee case to show the user what info they entered break; case "2": Console.WriteLine(""); for (int i = 0; i < employees.Count; i++) { Console.WriteLine(StandardMessages.DisplayEmployee(employees[i])); //For loop to display everything in the list } Console.WriteLine(""); break; case "3": Console.WriteLine(""); if (employees.Count == 0) //If statement is created just incase the user enters 3 as the first command { //the program will tell the user to enter an employee's information first Console.WriteLine(StandardMessages.ListIsEmptyError()); Console.WriteLine(""); break; } else { Console.WriteLine(StandardMessages.DisplayAverageAge(employees)); //Average age is calculated with the .Average() method } //I wasn't sure if it belonged here in main or in StandardMessages since it uses a method Console.WriteLine(""); break; case "4": exit = true; break; default: Console.WriteLine(StandardMessages.DisplayNumberError()); Console.WriteLine(""); break; } } while (exit == false); }