public static double AcceptNumberInput() { string strInput; double numInput = 0; while (true) { strInput = Console.ReadLine(); var isSuccess = double.TryParse(strInput, out numInput); if (isSuccess) { break; } else if (strInput.ToLower() == "quit") { Console.WriteLine("Bye,Bye!"); Console.ReadKey(); } else { Console.WriteLine("\nPlease enter a valid input and try again !"); FindOutput.FindOutput1(); break; } } return(numInput); }
static void Main(string[] args) { // logic to retry till the user enters 'quit' is missing = -1 Mark // why are you calling 'FindOutput1' from UserInput ? // It causing some bad results = -1 Mark // Try entering an invalid number and then enter a valid number. Notice the results. // Good job using "Double" When the questions doesn't say what type of number, always assume largest. // Total = 8 Marks FindOutput.FindOutput1(); }