public string show() { string m = string.Format ("[OverdrafAccount:\naccountnumber={0},\naccountholder={1},\nbalance={2}]", AccountNum, Accountholder.Show(), Balance); return(m); }
public static void Main() { string Accountholder; var user = new User(); while (string.IsNullOrEmpty(user.FirstName)) { user.FirstName = AskQuestion("Please enter your first name: "); } while (string.IsNullOrEmpty(user.LastName)) { user.LastName = AskQuestion("Please enter your last name: "); } Console.WriteLine($"Thank you, {user.FullName}."); do { Accountholder = AskQuestion("Are you account holder? | (Yes/No)"); } while (Accountholder.ToLower() != "yes"); Console.WriteLine($"Thank you {user.FullName}."); Console.WriteLine("What type of account do you have?"); foreach (Accounts.AccountsType item in Enum.GetValues(typeof(Accounts.AccountsType))) { Console.WriteLine("{0}. {1}", (int)item, item); } Read: Console.WriteLine("Select your Account type: "); var select = Console.ReadLine(); int option; if (!int.TryParse(select, out option)) { goto Read; } option = Convert.ToInt32(select); Console.WriteLine("You have seleceted: {0}", Enum.ToObject(typeof(Accounts.AccountsType), option)); user.PinNumber = AskIntQuestion("Please enter your account pin number.", 4); Console.WriteLine("Thank you for using our service."); Console.ReadLine(); }