/* * Name: Christopher Westman * Date(YYMM): 1801 * Course: Project & Portfolio 1 * Synopsis: This is a code challenge for Development. This challenge contains five sub-challenges. * Every Challenge will be contained within its own class file. * Each challenge solves a unique problem that must be solved. All challenges use the Validate class which * contains several different types of validations. The validations can validate for word counts, single string inputs, * and numbers within a certain range or above -1. This main program file is simplified to only show the calling of * each challenge. To see the challenge code, simply open the class file with the name that mirrors the method call, * for example, ChallengeOne can be found in the SwapInfo class file. */ static void Main(string[] args) { // Challenge 1 SwapInfo.ChallengeOne(); // Challenge 2 Backwards.ChallengeTwo(); // Challenge 3 AgeConvert.ChallengeThree(); // Challenge 4 TempConvert.ChallengeFour(); // Challenge 5 MainMenu.ChallengeFive(); }
// Method for Challenge 5 public static void ChallengeFive() { Console.WriteLine("You are now entering Challenge 5!\r\n"); // Use while loop to allow menu prompt while (true) { // Variable for user entry double entry; // Prompt user to select from menu Console.WriteLine("Which challenge would you like to try again?\r\n" + "Enter 1 for SwapInfo\r\n" + "Enter 2 for Backwards\r\n" + "Enter 3 for AgeConvert\r\n" + "Enter 4 for TempConvert\r\n" + "Or enter 0 to quit"); // Validate and store user entry entry = Validate.Menu(Console.ReadLine()); // Cycle through if statement to start user menu option if (entry == 1) { SwapInfo.ChallengeOne(); } else if (entry == 2) { Backwards.ChallengeTwo(); } else if (entry == 3) { AgeConvert.ChallengeThree(); } else if (entry == 4) { TempConvert.ChallengeFour(); } else if (entry == 0) { // Break out of while loop if user doesn't want to run program Console.WriteLine("Exiting now! Thanks for using the program!"); break; } } }