static void Main(string[] args) { // Example External Method Call // For your first challenge, create a Display() method in the menu class. CE1_Menu.WelcomeUser(); //Display the Menu from the first challange CE1_Menu.MenuChoice(); }
public static void TempConvertTest() { Console.WriteLine(" Welcome to TempConvert.Would you like to...\r\n " + "1.Convert temperature from Fahrenheit to Celsius \r\n " + "2.Convert temperature from Celsius to Fahrenheit \r\n " + "3.Convert temperature from Fahrenheit to Kelvin \r\n " + "4.Convert temperature from Celsius to Kelvin"); inputString = Console.ReadLine(); CE7_Validation.ValidateStringInput(); UserSelction(inputString); Console.WriteLine("Please press enter to return to the Main Menu"); Console.ReadLine(); //return to menu CE1_Menu.Display(); }
public static void AgeConvertTest() { //Ask for users name Console.WriteLine(" Welcome to AgeConvert:\r\n To begin, please enter your name...\r\n"); inputString = Console.ReadLine(); //Validate name CE7_Validation.ValidateStringInput(); myName = inputString; //Ask for users birth month Console.WriteLine("Thank you " + myName + ". Now I know this may be personal, but what's your age? \r\n Please enter the numerical month of your birth and press enter"); inputString = Console.ReadLine(); //Validate Int. need an extra check for length of int. CE7_Validation.ValidateIntInput(); birthMonth = int.Parse(inputString); Console.WriteLine("Birth Month is " + birthMonth); //Ask for birth month Console.WriteLine("Thank you " + myName + ". \r\n Please enter the numerical day of your birth and press enter"); inputString = Console.ReadLine(); //Validate input need an extra check for length of int. CE7_Validation.ValidateIntInput(); birthDay = int.Parse(inputString); Console.WriteLine("Birth Day is " + birthDay); //Ask for birth year Console.WriteLine("Thank you " + myName + ". \r\n Please enter the numerical year of your birth and press enter"); inputString = Console.ReadLine(); CE7_Validation.ValidateIntInput(); birthYear = int.Parse(inputString); Console.WriteLine("Birth year is " + birthYear); //give all arguments a value to make Date time work birthours = 0; birthMinutes = 0; birthSeconds = 0; DateTime myBrithday = new DateTime(birthYear, birthMonth, birthDay, birthours, birthMinutes, birthSeconds); //order //23 DateTime DoB = Convert.ToDateTime(myBrithday); string text = MyAgeSimplified(DoB); Console.WriteLine("Fantastic! Next time someone asks, try answering with:" + MyAgeSimplified(DoB) + "-OR-"); MyAgeUnSimplified(); Console.WriteLine("Please press enter to return to the Main Menu"); Console.ReadLine(); //return to menu CE1_Menu.Display();
public static void SwapNameTest() { //Prompt the user for their first and last names(separately) Console.WriteLine("Welcome to SwapName: \r\nTo begin, please enter your first name..."); CE7_Validation.ValidateStringInput(); inputString = Console.ReadLine(); string firstName = inputString; // Each time data is entered save and display the information Console.WriteLine("Thank you " + firstName + ", now I will need your last name..."); inputString = Console.ReadLine(); CE7_Validation.ValidateStringInput(); string lastName = inputString; // Each time data is entered save and display the information Console.WriteLine("Excellent! Your name " + firstName + " " + lastName + " reversed would be " + (SwapNameTest(firstName, lastName))); Console.WriteLine("Please press enter to return to the Main Menu"); Console.ReadLine(); //return to menu CE1_Menu.Display(); }
public static void BigBlueFishTest() { Console.WriteLine("Welcome to BigBlueFish: \r\n " + "Looking for the biggest fish matching a certain color ? \r\n " + "Please select a color of fish...\r\n" + "[1] Red \r\n" + "[2] Blue \r\n" + "[3] Yellow \r\n" + "[4] Green \r\n"); inputString = Console.ReadLine(); string newFishColor = ValidateFishColor(); // string newSize = GetSize(); Dictionary <float, string> CombinedDict = new Dictionary <float, string>(); Console.WriteLine("Your selection is " + inputString); //Selection: _2 float biggestsize = 0; for (int i = 0; i < sizes.Length; i++) { CombinedDict.Add(sizes[i], fishColor[i]); if (inputString == fishColor[i].ToString()) { if (sizes[i] > biggestsize) { biggestsize = sizes[i]; } } } Console.WriteLine("Whoa! Looks like the biggest " + newFishColor + " fish is " + biggestsize + " inches."); Console.WriteLine("Please press enter to return to the Main Menu"); Console.ReadLine(); //return to menu CE1_Menu.Display(); }
public static void ValidationTest() { //return to menu CE1_Menu.Display(); }
//Create a New method that will display a menu and prompt the user to make a selection public static void MenuChoice() { //Display the selection choices to the user Console.WriteLine("\r\n(1) Swap Name"); Console.WriteLine("(2) Backwards"); Console.WriteLine("(3) Age Convert"); Console.WriteLine("(4) Temp Convert"); Console.WriteLine("(5) Big Blue Fish"); Console.WriteLine("(0) EXIT"); //Prompt the user to make a selection Console.WriteLine("\r\nChoose your selection: "); string userInput = Console.ReadLine(); // Make sure the user is entering a valid selection bool choice = int.TryParse(userInput, out int selection); //Create a while loop to ensure the user is entering a number between 0-5 only while (choice == false || selection > 5 || selection < 0) { //Tell the user that they've made a mistake Console.WriteLine("You entered an invalid selection. Please enter a number that corresponds to a selection above."); //Store the users new input userInput = Console.ReadLine(); //Validate the users new input choice = int.TryParse(userInput, out selection); } // Confirm to the user the selection they entered Console.WriteLine("You have entered Challenge #{0}.", selection); //Begin switch statement that runs the class challenge the user selected switch (selection) { case 1: Console.WriteLine("The Swap Name Challenge, will now run.\r\n"); CE2___SwapName.SwapName(); //Display the menu again after the selection runs CE1_Menu.MenuChoice(); break; case 2: Console.WriteLine("The Backwards Challenge, will now run.\r\n"); CE3_Backwards.BackwardsGame(); //Display the menu again after the selection runs CE1_Menu.MenuChoice(); break; case 3: Console.WriteLine("The Age Convert Challenge, will now run.\r\n"); CE4_AgeConvert.AgeConvert(); //Display the menu again after the selection runs CE1_Menu.MenuChoice(); break; case 4: Console.WriteLine("The Temp CpnvertChallenge, will now run.\r\n"); CE5_TempConvert.TempConvert(); //Display the menu again after the selection runs CE1_Menu.MenuChoice(); break; case 5: Console.WriteLine("The Big Blue Fish Challenge, will now run.\r\n"); CE6_BigBlueFish.BigBlueFish(); //Display the menu again after the selection runs CE1_Menu.MenuChoice(); break; case 0: Console.WriteLine("You will now return to the main menu.\r\n"); CE1_Menu.MenuChoice(); break; default: Console.WriteLine("Please enter a valid selection from the above menu."); break; //Outputs based on user selection } }
static void Main(string[] args) { // Example External Method Call // For your first challenge, create a Display() method in the menu class. CE1_Menu.Display(); }