public DepositAccount(CustromerType customer, decimal balance, decimal interestRate) : base(customer, balance, interestRate) { }
public static List <Account> Accounts() { var accounts = new List <Account>(); var customer = new CustromerType(); var depositAccount = new DepositAccount(); var loanAccount = new LoanAccount(); Console.Write("Number of accounts to add: "); var numberOfAccounts = int.Parse(Console.ReadLine()); for (int i = 1; i <= numberOfAccounts; i++) { var customerType = 0; var accountType = 0; Console.WriteLine("[{0}] Account", i); do { Console.WriteLine("Custromer types"); Console.WriteLine("1. Individual"); Console.WriteLine("2. Company"); Console.Write("Custromer: "); customerType = int.Parse(Console.ReadLine()); } while (customerType < 1 || customerType > 2); do { Console.WriteLine("Account types"); Console.WriteLine("1. Deposit account"); Console.WriteLine("2. Loan account"); Console.WriteLine("3. Mortgage account"); Console.Write("Account: "); accountType = int.Parse(Console.ReadLine()); } while (accountType < 1 || accountType > 3); Console.Write("Balance: "); decimal balance = decimal.Parse(Console.ReadLine()); Console.Write("Interest rate: "); decimal interestRate = decimal.Parse(Console.ReadLine()); switch (customerType) { case 1: customer = CustromerType.Individual; break; case 2: customer = CustromerType.Company; break; } switch (accountType) { case 1: accounts.Add(new DepositAccount(customer, balance, interestRate)); break; case 2: accounts.Add(new LoanAccount(customer, balance, interestRate)); break; case 3: accounts.Add(new MortgageAccount(customer, balance, interestRate)); break; default: break; } Console.Clear(); } return(accounts); }
public static List<Account> Accounts() { var accounts = new List<Account>(); var customer = new CustromerType(); var depositAccount = new DepositAccount(); var loanAccount = new LoanAccount(); Console.Write("Number of accounts to add: "); var numberOfAccounts = int.Parse(Console.ReadLine()); for (int i = 1; i <= numberOfAccounts; i++) { var customerType = 0; var accountType = 0; Console.WriteLine("[{0}] Account", i); do { Console.WriteLine("Custromer types"); Console.WriteLine("1. Individual"); Console.WriteLine("2. Company"); Console.Write("Custromer: "); customerType = int.Parse(Console.ReadLine()); } while (customerType < 1 || customerType > 2); do { Console.WriteLine("Account types"); Console.WriteLine("1. Deposit account"); Console.WriteLine("2. Loan account"); Console.WriteLine("3. Mortgage account"); Console.Write("Account: "); accountType = int.Parse(Console.ReadLine()); } while (accountType < 1 || accountType > 3); Console.Write("Balance: "); decimal balance = decimal.Parse(Console.ReadLine()); Console.Write("Interest rate: "); decimal interestRate = decimal.Parse(Console.ReadLine()); switch (customerType) { case 1: customer = CustromerType.Individual; break; case 2: customer = CustromerType.Company; break; } switch (accountType) { case 1: accounts.Add(new DepositAccount(customer, balance, interestRate)); break; case 2: accounts.Add(new LoanAccount(customer, balance, interestRate)); break; case 3: accounts.Add(new MortgageAccount(customer, balance, interestRate)); break; default: break; } Console.Clear(); } return accounts; }
public MortgageAccount(CustromerType customer, decimal balance, decimal interestRate) : base(customer, balance, interestRate) { }
protected Account() { this.customer = CustromerType.Individual; this.balance = decimal.MinValue; this.interestRate = decimal.MinValue; }
protected Account(CustromerType customer, decimal balance, decimal interestRate) { this.customer = customer; this.balance = balance; this.interestRate = interestRate; }
public Account(CustromerType customer, decimal balance, decimal interestRate) { _customer = customer; _balance = balance; _interestRate = interestRate; }
public Account() { _customer = CustromerType.Individual; _balance = decimal.MinValue; _interestRate = decimal.MinValue; }