static void Main(string[] args) { CheckingAccount account = new CheckingAccount(); Console.WriteLine("Enter how much loot you want to start with:"); account.Deposit(Convert.ToDecimal(Console.ReadLine())); Console.WriteLine("Welcome to We Can Bank IT!"); Console.WriteLine("Your account has $" + account.Balance); Console.WriteLine("1234567890\n" + "ABCDEFGHIJ\n" + "abcdefghij\n" + "1 3 5 7 9 \tTAB"); Console.WriteLine("...Program Done... Press a key to exit"); Console.ReadKey(); }
public Account CreateAccount(AccountType type, Customer customer) { Account acc = null; switch (type) { case AccountType.CheckingAccount: var chk = new CheckingAccount(Guid.NewGuid()); chk.WithdrawLimit = 2500 * (decimal)customer.BaseLimitFactor; acc = chk; break; case AccountType.SavingsAccount: var sav = new SavingsAccount(Guid.NewGuid()); sav.InterestRate = (new Random().Next(5) + 1) / 100.0; acc = sav; break; } return(acc); }
public Account CreateAccount(AccountType type) { Account acc = null; switch (type) { case AccountType.CheckingAccount: var chk = new CheckingAccount(Guid.NewGuid()); chk.WithdrawLimit = 2500; acc = chk; break; case AccountType.SavingsAccount: var sav = new SavingsAccount(Guid.NewGuid()); sav.InterestRate = (new Random().Next(5) + 1) / 100.0; acc = sav; break; } if (acc != null) { _accounts.Add(acc.AccountNumber, acc); } return(acc); }
public static void AddAccount(int type) { if (type == 1) { int accountNumberAutogenerate = count; Console.WriteLine("Enter Your name- "); string accountName = Convert.ToString(Console.ReadLine()); Console.WriteLine("Enter Your Bank Balance - "); double balance = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Enter Your road NO - "); string roadNO = Console.ReadLine(); Console.WriteLine("Enter Your House NO - "); string houseNo = Console.ReadLine(); Console.WriteLine("Enter Your city Name - "); string city = Console.ReadLine(); Console.WriteLine("Enter Your county name - "); string country = Console.ReadLine(); myBank[count] = new SavingsAccounts(accountNumberAutogenerate, accountName, balance, new Address(roadNO, houseNo, city, country)); } else { int accountNumberAutogenerate = count; Console.WriteLine("Enter Your name- "); string accountName = Convert.ToString(Console.ReadLine()); Console.WriteLine("Enter Your Bank Balance - "); double balance = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Enter Your road NO - "); string roadNO = Console.ReadLine(); Console.WriteLine("Enter Your House NO - "); string houseNo = Console.ReadLine(); Console.WriteLine("Enter Your city Name - "); string city = Console.ReadLine(); Console.WriteLine("Enter Your county name - "); string country = Console.ReadLine(); myBank[count] = new CheckingAccount(accountNumberAutogenerate, accountName, balance, new Address(roadNO, houseNo, city, country)); } Console.WriteLine(); Console.WriteLine(" Account created successfully. "); Console.WriteLine(); count++; }
static void Main(string[] args) { int balance; string accountName; int menuOption = 0; CheckingAccount checking = null; SavingsAccount savings = null; while (menuOption != 1) { menuOption = GetNumber("1 - Exit\n2 - " + "Create Checking\n3 - Create Savings\n4 - " + "Check Checking Balane\n5 - Check Saving Balance\n6 -" + " Deposit To Checking\n7 - Deposit To Savings "); switch (menuOption) { case 1: break; case 2: accountName = GetInput("Account Name"); balance = GetNumber("Initial Amt: "); checking = new CheckingAccount(accountName, balance, 0.02f); break; case 3: accountName = GetInput("Account Name"); balance = GetNumber("Initial Amt: "); savings = new SavingsAccount(accountName, balance, 0.03f); break; case 4: Console.WriteLine("Your Checking Account currently is: " + checking); break; case 5: Console.WriteLine("Your Saving Account currently is:" + savings); break; case 6: accountName = GetInput("Account Name"); int CheckingDposit = Utils.GetNumber("How much will you be depositing?: "); checking.Deposit(CheckingDposit); Console.WriteLine(CheckingDposit + " Has been added"); break; case 7: accountName = GetInput("Account Name"); int savingDeposit = Utils.GetNumber("How much will you be depositing?: "); savings.Deposit(savingDeposit); Console.WriteLine(savingDeposit + " Has been added"); break; default: break; } } }