public override void PaymentMethod() { Console.WriteLine("Your amount is: " + GetTotalPrice.CalculateFinalCost()); try { do { Console.WriteLine("Please enter card pin below: "); CardNumber = int.Parse(Console.ReadLine()); } while (cardNumber.ToString().Length < cardNumberlength || cardNumber.ToString().Length > cardNumberlength); Console.WriteLine(" Please enter your pin Number"); UserCardPin = int.Parse(Console.ReadLine()); Console.WriteLine("Thank you payment has been successful"); } catch (Exception error) { Console.WriteLine(error.Message); } }
public override void PaymentMethod() { Console.WriteLine("Please enter the amount of cash given below"); getCash = double.Parse(Console.ReadLine()); if (getCash == GetTotalPrice.CalculateFinalCost()) { Console.WriteLine("Thanks for the payment."); } else if (getCash > GetTotalPrice.CalculateFinalCost()) { change = GetTotalPrice.CalculateFinalCost() - getCash; Console.WriteLine("Your Change is: " + change); } else if (getCash < GetTotalPrice.CalculateFinalCost()) { Console.WriteLine("You need more cash!!!"); } else { Console.WriteLine("Invalid Input"); } }