// Method to capture the Length of Rectangle and validate input is not a zero, negative number or a nonnumeric value private static double recLength() { // Variable for Length var length = 0.0; try { if (Double.TryParse(Console.ReadLine(), out length)) try { // Validate input is a positive number if (length <= 0.0) catch { // Error Message if input is zero or a negative number Console.WriteLine("\n\tSorry, you enter a number zero or less. Please try again."); } catch { // Error Message if input is not numeric Console.WriteLine("\n\tSorry, you entered a non-numeric value. Please try again."); } finally { // Prompt for Length of Rectangle Console.Write("\n\tPlease Enter the Length of Rectangle: "); // Call Method again length = recLength(); return length; } } }