public decimal PromptForPayment() { _prompt.Message = "\n" + "Please pay for your order using " + PaymentType.ToLower() + ". Enter the amount to pay:"; //Get input and trim any $ symbol, the user might have specified. string userResponse = Prompt.CleanCurrencyInput(_prompt.GetUserInput()); while (!decimal.TryParse(userResponse, out decimal num) || Convert.ToDecimal(userResponse) < TotalPrice) // while not a decimal value that is at least the amount requested { // Validate Payment (did they give enough money?) if (decimal.TryParse(userResponse, out num) && (Convert.ToDecimal(userResponse) < TotalPrice)) { _prompt.Message = "Inadequate amount received. You are " + (TotalPrice - Convert.ToDecimal(userResponse)).ToString("C") + " short. Please pay the full amount: " + TotalPrice.ToString("C"); } else { _prompt.Message = "That is not a valid numeric response. Please enter a number:"; } //Get input and trim any $ symbol, the user might have specified. userResponse = Prompt.CleanCurrencyInput(_prompt.GetUserInput()); } return(Convert.ToDecimal(userResponse)); }