private static string getTaxiFareInputStringValue(TaxiFareInputType inputType) { var returnValue = string.Empty; Console.WriteLine($"Provide a value for {EnumHelper<TaxiFareInputType>.GetDisplayValue(inputType)}."); var correctInput = false; while (!correctInput) { var inputValue = Console.ReadLine(); if (!string.IsNullOrEmpty(inputValue)) { correctInput = true; } else { correctInput = false; } if (!correctInput) { Console.WriteLine($"Incorrect value for {EnumHelper<TaxiFareInputType>.GetDisplayValue(inputType)}."); } } return(returnValue); }
private static float getTaxiFareInputFloatValue(TaxiFareInputType inputType) { var returnValue = 0.0f; Console.WriteLine($"Provide a value for {EnumHelper<TaxiFareInputType>.GetDisplayValue(inputType)}."); var correctInput = false; while (!correctInput) { var inputValue = Console.ReadLine(); if (float.TryParse(inputValue, out returnValue)) { correctInput = true; } else { correctInput = false; } if (!correctInput) { Console.WriteLine($"Incorrect value for {EnumHelper<TaxiFareInputType>.GetDisplayValue(inputType)}."); } } return(returnValue); }