Exemplo n.º 1
0
        // Read all data from database and add it to bank
        private List <Account> ReadFromDatabase()
        {
            List <Account> accounts = new List <Account>();

            using (MyDbContext db = new MyDbContext())
            {
                foreach (var item in db.AccountsData)
                {
                    Account acc;
                    if (item.Type == "Deposit")
                    {
                        int         id   = item.AccountId;
                        float       pers = Bank <Account> .DEPOSIT_PERCENTAGE;
                        AccountType type = AccountType.Deposit;
                        acc = new DepositAccount(item.Sum, pers, type, (DateTime)item.Date, id) as Account;
                    }
                    else
                    {
                        int         id   = item.AccountId;
                        float       pers = 0;
                        AccountType type = AccountType.Ordinary;
                        acc = new DemandAccount(item.Sum, pers, type, id) as Account;
                    }
                    if (acc != null)
                    {
                        accounts.Add(acc);
                    }
                }
            }
            return(accounts);
        }
Exemplo n.º 2
0
        static void Main()
        {
            ICustomer[] clients =
            {
                new IndividualCustomer("Kiril"),
                new IndividualCustomer("Nakov"),
                new CompanyCustomer("SoftUni"),
            };

            DepositAccount  kirilDepositAccount  = new DepositAccount(clients[0], 888.354m, 55);
            MortgageAccount nakovMortgageAccount = new MortgageAccount(clients[1], 3415.77m, 12);
            LoanAccount     softUniLoanAccount   = new LoanAccount(clients[2], 56756.789m, 3);

            kirilDepositAccount.Withdraw(123.77m);
            nakovMortgageAccount.Deposit(124.55m);
            softUniLoanAccount.Deposit(1779.33m);

            // Try false input
            try
            {
                kirilDepositAccount.Withdraw(1000m);
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine(kirilDepositAccount);
            Console.WriteLine(nakovMortgageAccount);
            Console.WriteLine(softUniLoanAccount + $"\nInterest rate: {softUniLoanAccount.CalculateInterest(3)}");
        }
    private static void Main()
    {
        // Individual account test
        Costumer ivan = new Costumer("Ivan Ivanov", CostumerTypes.Individual);

        DepositAccount ivanDepositAccount = new DepositAccount(ivan, 1, 1000);

        int months = 5;

        decimal ivanInterest = ivanDepositAccount.CalculateInterest(months);

        Console.WriteLine(ivanDepositAccount.ToString() + "\n Interest for {0} months : {1}", months, ivanInterest + "\n");

        ivanDepositAccount.Withdraw(500);

        Console.WriteLine("After withdraw 500  \n" + ivanDepositAccount.ToString() + "\n");

        // Company Account test
        Costumer kokoOod = new Costumer("KOKO OOD", CostumerTypes.Company);

        LoanAccount kokoLoanAccount = new LoanAccount(kokoOod, 2, 50000);

        months = 12;

        decimal kokoInterest = kokoLoanAccount.CalculateInterest(months);
        Console.WriteLine(kokoLoanAccount.ToString() +
            "\n Interest for {0} months : {1}", months, kokoInterest + "\n");

        months = 13;
        kokoInterest = kokoLoanAccount.CalculateInterest(months);
        Console.WriteLine(kokoLoanAccount.ToString() +
            "\n Interest for {0} months : {1}", months, kokoInterest + "\n");
    }
Exemplo n.º 4
0
        // Write a program to model the bank system by classes and interfaces.
        // Identify the classes, interfaces, base classes and abstract actions
        // and implement the calculation of the interest functionality through overridden methods.
        private static void Main()
        {
            Client client1 = new ClientIndividual("Neo");
            Client client2 = new ClientCompany("Office 1");
            Client client3 = new ClientIndividual("Nakov");

            Account acc1 = new DepositAccount(client1, 5, "BG13TLRK01");
            Account acc2 = new LoanAccount(client2, 4.5m, "BG13TLRK02");
            Account acc3 = new MortgageAccount(client3, 8.8m, "BG13TLRK03");

            acc1.DepositMoney(1000);
            ((DepositAccount)acc1).WithdrawMoney(500);
            acc2.DepositMoney(10000);

            Bank bank = new Bank("New Bank");

            bank.AddAccount(acc1);
            bank.AddAccount(acc2);
            bank.AddAccount(acc3);

            Console.WriteLine(bank.Accounts);

            Console.WriteLine();
            Console.WriteLine("IBAN: {0} ({1}), Interest: {2:F2}", acc1.IBAN, acc1.Owner.Name, acc1.CalculateInterest(5));
            Console.WriteLine("IBAN: {0} ({1}), Interest: {2:F2}", acc2.IBAN, acc2.Owner.Name, acc2.CalculateInterest(6));
            Console.WriteLine("IBAN: {0} ({1}), Interest: {2:F2}", acc3.IBAN, acc3.Owner.Name, acc3.CalculateInterest(18));

            Console.WriteLine("\nRemoving account 1");
            bank.RemoveAccount(acc1);
            Console.WriteLine(bank.Accounts);
        }
Exemplo n.º 5
0
        internal static void CreateAccount(Bank mybank)
        {
            Console.WriteLine("\nSelect Account type:\n1. Loan Account,  2.Deposit Account");
            Console.Write("Your Reply: ");
            string    option = Console.ReadLine();
            ICustomer newCustomer; decimal startAmt;

            switch (Convert.ToInt32(option))
            {
            case 1:
                Console.Write("Enter Amount: ");
                startAmt = Utility.GetDecimal(Console.ReadLine());
                Console.WriteLine("Enter Loan Duration (greater than 3): ");
                int duration = Convert.ToInt32(Console.ReadLine());
                newCustomer = GenerateNewCustomer(GetCustomerType());
                LoanAccount acct = new LoanAccount(newCustomer, startAmt, duration);
                mybank.AddNewAccount(acct);
                break;

            case 2:
                Console.Write("Enter Amount: ");
                startAmt = Utility.GetDecimal(Console.ReadLine());
                Console.Write("Choose your Deposit Account Type\n Reply with Student,Savings or Current:  ");
                DepositAccountType acctType = Utility.GetDepositAccountType(Console.ReadLine());
                newCustomer = GenerateNewCustomer(GetCustomerType());
                DepositAccount acctDep = new DepositAccount(newCustomer, acctType, startBalance: startAmt);
                mybank.AddNewAccount(acctDep);
                break;

            default:
                throw new ArgumentException("Invalid Account type entered.");
            }
        }
Exemplo n.º 6
0
    static void Main()
    {
        Bank bank = new Bank();

        DepositAccount depAccC = new DepositAccount(new Company(), 300M, 0.4M);
        DepositAccount depAccI = new DepositAccount(new Individual(), 1000M, 0.4M);

        LoanAccount loanAccC = new LoanAccount(new Company(), 1000M, 0.4M);
        LoanAccount loanAccI = new LoanAccount(new Individual(), 1000M, 0.4M);

        MortgageAccount mortAccC = new MortgageAccount(new Company(), 1000M, 0.4M);
        MortgageAccount mortAccI = new MortgageAccount(new Individual(), 1000M, 0.4M);

        bank.AddAccount(depAccC);
        bank.AddAccount(depAccI);
        bank.AddAccount(loanAccC);
        bank.AddAccount(loanAccI);
        bank.AddAccount(mortAccC);
        bank.AddAccount(mortAccI);

        foreach (var acc in bank.Accounts)
        {
            Console.WriteLine(acc.CalculateInterestAmount(12));
        }
    }
Exemplo n.º 7
0
        static void Main()
        {
            DepositAccount depositAccount = new DepositAccount(new Customer("Pesho", "individual"), 1200m, 10m);
            DepositAccount companyDepositAccount = new DepositAccount(new Customer("Goshos", "company"), 160000m, 8m);
            LoanAccount loanAccount = new LoanAccount(new Customer("Gosho", "individual"), 8000m, 12m);
            MortgageAccount morgageAccount = new MortgageAccount(new Customer("Peshovi", "company"), 12000m, 16m);

            Console.WriteLine("Deposit balanse: " + depositAccount.Balance);
            depositAccount.Deposit(1000);
            Console.WriteLine("After deposit 1000: " + depositAccount.Balance);
            depositAccount.Withdraw(1200);
            Console.WriteLine("After withdraw 1200: " + depositAccount.Balance);
            Console.WriteLine();

            Console.WriteLine("Loan balanse: " + loanAccount.Balance);
            loanAccount.Deposit(1000);
            Console.WriteLine("After deposit 1000: " + loanAccount.Balance);
            Console.WriteLine();

            Console.WriteLine("Morgage balanse: " + morgageAccount.Balance);
            morgageAccount.Deposit(1000);
            Console.WriteLine("After deposit 1000: " + morgageAccount.Balance);
            Console.WriteLine();

            Console.WriteLine("Diderent interest calculations: ");
            Console.WriteLine(depositAccount.CalculateInterest(5));
            Console.WriteLine(depositAccount.CalculateInterest(5));
            Console.WriteLine(loanAccount.CalculateInterest(3));
            Console.WriteLine(loanAccount.CalculateInterest(4));
            Console.WriteLine(morgageAccount.CalculateInterest(6));
            Console.WriteLine(morgageAccount.CalculateInterest(7));
            Console.WriteLine(companyDepositAccount.CalculateInterest(12));
            Console.WriteLine(companyDepositAccount.CalculateInterest(13));
        }
Exemplo n.º 8
0
    static void Main()
    {
        Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

        DepositAccount depAccountInd = new DepositAccount(new Individual("Boyko Draganov", "9090909090"), 230m, 0.003m);
        DepositAccount depAccountComp = new DepositAccount(new Company("Barista", "999999999"), 13000m, 0.006m);

        MortgageAccount mortAccountInd = new MortgageAccount(new Individual("Georgi Dimitrov", "9090909190"), 2300m, 0.005m);
        MortgageAccount mortAccountComp = new MortgageAccount(new Company("Sky", "999999999"), 35000m, 0.008m);

        LoanAccount loanAccountInd = new LoanAccount(new Individual("Hani Kovachev", "9090909190"), 2300m, 0.005m);
        LoanAccount loanAccountComp = new LoanAccount(new Company("Scraper BG", "999999999"), 5000m, 0.002m);

        List<Account> accounts = new List<Account>(){depAccountInd, depAccountComp, mortAccountInd, mortAccountComp,
        loanAccountInd, loanAccountComp};

        foreach (var acc in accounts)
        {
            Console.WriteLine("I am {0}, I am owned by {1}, my current balance is \n{2} and the interest rate for {3} months is: {4:F2}", acc.GetType(),
                acc.Customer.GetType(), acc.Balance, 3, acc.CalculateInterest(3));
            Console.WriteLine(new string('-', 50));
        }
        depAccountInd.DepositMoney(1000);
        depAccountInd.WithdrawMoney(130);

        Console.WriteLine("Deposit Account owned by Individual:\nMy current balance is:{0}, and my interest for 2 months is: {1:F2}",
        depAccountInd.Balance, depAccountInd.CalculateInterest(2));
    }
Exemplo n.º 9
0
        public async Task <IActionResult> Edit(int id, DepositAccount depositAccount)
        {
            if (id != depositAccount.DepositAccountId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    //var depositAmnt = _context.DepositAccounts.Find(id).DepositAmount;
                    if (depositAccount.DepositAmount != depositAccount.Balance)
                    {
                        depositAccount.Balance = depositAccount.DepositAmount;
                    }
                    _context.Update(depositAccount);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DepositAccountExists(depositAccount.DepositAccountId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(depositAccount));
        }
Exemplo n.º 10
0
    static void Main(string[] args)
    {
        Bank myBank = new Bank();
        myBank.AddAccount(new DepositAccount(Customer.Company, 200m, 1.5m));
        myBank.AddAccount(new LoanAccount(Customer.Individual, -20, 2m));
        myBank.AddAccount(new MortgageAccount(Customer.Individual, -100m, 3m));

        Account acc = new DepositAccount(Customer.Individual, 200m, 4m);
        myBank.AddAccount(acc);

        foreach (var account in myBank.Accounts)
        {
            Console.WriteLine("{0}(Money = {1})'s interest => {2}", account.GetType(), account.Balance, account.CalculateInterest(14));
        }

        myBank.RemoveAccount(acc);

        if (acc is DepositAccount)
        {
            DepositAccount changeAcc = acc as DepositAccount;
            changeAcc.Deposit(1000);
            changeAcc.WithDraw(100);
            myBank.AddAccount(changeAcc);
        }

        Console.WriteLine();
        foreach (var account in myBank.Accounts)
        {
            Console.WriteLine("{0}(Money = {1})'s interest => {2}", account.GetType(), account.Balance, account.CalculateInterest(14));
        }
    }
Exemplo n.º 11
0
        public static void Main()
        {
            ICustomer[] clients =
            {
                new IndividualCustomer("Pesho"),
                new IndividualCustomer("Gosho"),
                new CompanyCustomer("Soft Uni LTD"),
                new CompanyCustomer("Soft Uni Student Organisation"),
            };

            var depositAcc  = new DepositAccount(clients[0], 8955.33m, 0.005);
            var loanAcc     = new LoanAccount(clients[1], 1200m, 0.002);
            var mortgageAcc = new MortgageAccount(clients[2], 7005m, 0.009);
            var depositAcc2 = new DepositAccount(clients[3], 159, 0.08);

            depositAcc.Withdraw(6000m);
            depositAcc2.Withdraw(54.22m);
            mortgageAcc.Deposit(15m);
            loanAcc.Deposit(5559.66m);

            try
            {
                depositAcc.Withdraw(500000000m);
            }
            catch (ArgumentException ex)
            {
                Console.Error.WriteLine(ex.Message);
            }

            Console.WriteLine(depositAcc2);
            Console.WriteLine(mortgageAcc);

            Console.WriteLine(loanAcc + $" Interest rate: {loanAcc.CalculateIntereset(12):C}");
        }
Exemplo n.º 12
0
    static void Main()
    {
        Customer examplePerson = new Customer("Example Person", CustomerType.Individual);
        Customer exampleCompany = new Customer("Example Company", CustomerType.Company);

        DepositAccount deposit = new DepositAccount(examplePerson, 1200, (decimal)0.02);
        int period = 2;
        Console.WriteLine("Interest for: {0}, account type: {1}, balance: {2}, period: {3} months, interest rate: {4}%\n{5}%",
            deposit.Customer, deposit.GetType(), deposit.Balance, period, deposit.IntrestRate, deposit.CalcInterestAmount(period));

        deposit.Withdraw(300);
        Console.WriteLine("Interest for: {0}, account type: {1}, balance: {2}, period: {3} months, interest rate: {4}%\n{5}%",
            deposit.Customer, deposit.GetType(), deposit.Balance, period, deposit.IntrestRate, deposit.CalcInterestAmount(period));

        deposit.Deposit(1000);
        Console.WriteLine("Test depositing money balance: {0}", deposit.Balance);

        period = 3;
        Loan loan = new Loan(examplePerson, 1200, (decimal)0.02);
        Console.WriteLine("Interest for: {0}, account type: {1}, balance: {2}, period: {3} months, interest rate: {4}%\n{5}%",
            loan.Customer, loan.GetType(), loan.Balance, period, loan.IntrestRate, loan.CalcInterestAmount(period));

        period = 4;
        Console.WriteLine("Interest for: {0}, account type: {1}, balance: {2}, period: {3} months, interest rate: {4}%\n{5}%",
            loan.Customer, loan.GetType(), loan.Balance, period, loan.IntrestRate, loan.CalcInterestAmount(period));

        loan.Deposit(1200);
        Console.WriteLine("After repaying the loan the balance is: {0}", loan.Balance);

        //invalid period test
        //Console.WriteLine(loan.CalcInterestAmount(-3));
    }
 public Account createNewAccount(String type, String ownerName, String currency)
 {
     if (!(type.Equals("deposit") || type.Equals("savings")))
     {
         throw new ArgumentException("Invalid Account type");
     }
     if (ownerName.Length < 4 || !ownerName.Contains(" "))
     {
         throw new ArgumentException("Invalid Owner name");
     }
     if (type.Equals("deposit"))
     {
         DepositAccount account = new DepositAccount(ownerName, currency);
         memrepo.deposticAccounts.Add(account);
         memrepo.SaveChanges();
         return(account);
     }
     else
     {
         SavingsAccount account = new SavingsAccount(ownerName, currency);
         memrepo.savingsAccounts.Add(account);
         memrepo.SaveChanges();
         return(account);
     }
 }
Exemplo n.º 14
0
    static void Main()
    {
        BankAccount testAccount0 = new DepositAccount(Customer.Individual, "pesho", 298012, 23);
        BankAccount testAccount1 = new DepositAccount(Customer.Individual, "poor pesho", 823, 123.123m);
        BankAccount testAccount2 = new DepositAccount(Customer.Company, "pesho Co.", 1234.123m, 233.1m);

        BankAccount testAccount3 = new DepositAccount(Customer.Individual, "gosho", 128937.123m, 7.34m);
        BankAccount testAccount4 = new DepositAccount(Customer.Company, "gosho Co.", 1542352381.123m, 283.67m);

        BankAccount testAccount5 = new DepositAccount(Customer.Individual, "stamat", 23613, 2.3m);
        BankAccount testAccount6 = new DepositAccount(Customer.Company, "Stamat Co.", 5473137, 8347.123m);

        List <BankAccount> accounts = new List <BankAccount>();

        accounts.Add(testAccount0);
        accounts.Add(testAccount1);
        accounts.Add(testAccount2);
        accounts.Add(testAccount3);
        accounts.Add(testAccount4);
        accounts.Add(testAccount5);
        accounts.Add(testAccount6);
        int period1 = 10, period2 = 32;

        foreach (var account in accounts)
        {
            Console.WriteLine("Interest for {0} months: {1}", period1, account.CalculateInterest(period1));
            Console.WriteLine("Interest for {0} months: {1}", period2, account.CalculateInterest(period2));
        }
    }
Exemplo n.º 15
0
        public async Task <IActionResult> GetPercents(int id)
        {
            try
            {
                DepositContract contract = await _context.DepositContracts
                                           .Include(c => c.Deposit)
                                           .Where(c => c.EndDate.CompareTo(DateTime.Today) > 0 && c.Deposit.IsRevocable)
                                           .FirstOrDefaultAsync(c => c.Id == id);

                if (contract == null)
                {
                    return(RedirectToAction("Details", new { id }));
                }
                Account cashRegisterAccount = await _context.Accounts.FirstAsync(a => a.Name == "cash");

                DepositAccount percentAccount = await _context.DepositAccounts.FirstAsync(da => da.DepositContractId == contract.Id && da.IsForPercents);

                percentAccount.Debet       += percentAccount.Saldo;
                cashRegisterAccount.Credit += percentAccount.Saldo;
                cashRegisterAccount.Debet  += percentAccount.Saldo;
                percentAccount.Saldo        = 0;
                _context.Accounts.Update(percentAccount);
                _context.Accounts.Update(cashRegisterAccount);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(RedirectToAction("Error", "Home"));
            }
        }
Exemplo n.º 16
0
        static void Main()
        {
            Customers kris = new Individuals("Kris", "65654756765", "Sofia", new DateTime(1990, 10, 25));

            Customers krisOOD = new Companies("Kris OOD", "65654656765", "Plovdiv", 325343);

            Console.WriteLine(krisOOD is Individuals);
            Console.WriteLine(kris is Individuals);

            Bank mortgageAccTest = new MortgageAccount(200.2m, 0.6m, kris);
            Bank mortgageAccTest1 = new MortgageAccount(200.2m, 0.6m, krisOOD);

            Console.WriteLine(mortgageAccTest.CalculateInterest(15));
            Console.WriteLine(mortgageAccTest1.CalculateInterest(15));

            Bank loanAccTest = new LoanAccount(200.2m, 0.6m, kris);
            Bank loanAccTest1 = new LoanAccount(200.2m, 0.6m, krisOOD);

            Console.WriteLine(loanAccTest.CalculateInterest(11));
            Console.WriteLine(loanAccTest1.CalculateInterest(11));

            Bank depositAccTest = new DepositAccount(3200.2m, 0.6m, kris);
            Bank depositAccTest1 = new DepositAccount(1200.2m, 0.6m, krisOOD);

            Console.WriteLine(depositAccTest.CalculateInterest(11));
            Console.WriteLine(depositAccTest1.CalculateInterest(11));

            depositAccTest.Deposit(200);
            Console.WriteLine(depositAccTest.Balance);
            var depositAcc = depositAccTest as DepositAccount;
            depositAcc.Draw(300);
            Console.WriteLine(depositAcc.Balance);
        }
        static void Main()
        {
            Console.WriteLine("DEPOSIT ACCOUNT");
            DepositAccount depositAccount = new DepositAccount(Customer.Companies, 5000.50m, 4.5m);
            Console.WriteLine(depositAccount.InterestRateForAPeriodCalculation(5));
            Console.WriteLine(depositAccount.Balance);
            depositAccount.Deposit(1000m);
            Console.WriteLine(depositAccount.Balance);
            Console.WriteLine(depositAccount.InterestRateForAPeriodCalculation(5));
            depositAccount.Widthraw(5500m);
            Console.WriteLine(depositAccount.Balance);
            Console.WriteLine(depositAccount.InterestRateForAPeriodCalculation(5));
            Console.WriteLine();

            Console.WriteLine("LOAN ACCOUNT");
            LoanAccount loanAccount = new LoanAccount(Customer.Individual, 5000, 10);
            Console.WriteLine(loanAccount.InterestRateForAPeriodCalculation(3));

            loanAccount.Customer = Customer.Companies;
            Console.WriteLine(loanAccount.InterestRateForAPeriodCalculation(3));
            Console.WriteLine();

            Console.WriteLine("MORTGAGE ACCOUNT");
            MortgageAccount mortgageAccount = new MortgageAccount(Customer.Companies, 4000m, 5.45m);
            Console.WriteLine(mortgageAccount.InterestRateForAPeriodCalculation(6));
        }
Exemplo n.º 18
0
        static void Main()
        {
            IAccount       depositIndividualAccount = new DepositAccount(Customer.Individual, 120.00m, 21.00m);
            DepositAccount depositCompany           = new DepositAccount(Customer.Company, 240.00m, 25.00m);
            IAccount       loanIndividial           = new LoanAccount(Customer.Individual, 20.00m, 15.00m);
            IAccount       loanCompany        = new LoanAccount(Customer.Company, 200.00m, 17.00m);
            IAccount       mortgageIndividial = new MortgageAccount(Customer.Individual, 2000.00m, 5.00m);
            IAccount       mortgageCompany    = new MortgageAccount(Customer.Company, 5000.00m, 7.00m);

            Console.WriteLine("Deposit individial account CalculateInterestAmountForPeriod for 5 month is ${0}",
                              depositIndividualAccount.CalculateInterestAmountForPeriod(5));
            Console.WriteLine("Deposit individial account Balance before deposit is ${0}", depositIndividualAccount.Balance);
            depositIndividualAccount.Deposit(50);
            Console.WriteLine("Deposit individial account Balance after deposit is ${0}", depositIndividualAccount.Balance);
            Console.WriteLine("Deposit company account CalculateInterestAmountForPeriod for 2 month is ${0}",
                              depositCompany.CalculateInterestAmountForPeriod(2));
            Console.WriteLine("Deposit company account Balance before draw money is ${0}", depositCompany.Balance);
            depositCompany.DrawMoney(2000);
            Console.WriteLine("Deposit company account Balance after draw money is ${0}", depositCompany.Balance);
            Console.WriteLine("Loan individial account CalculateInterestAmountForPeriod for 2 month is ${0}",
                              loanIndividial.CalculateInterestAmountForPeriod(2));
            Console.WriteLine("Loan company account CalculateInterestAmountForPeriod for 1 month is ${0}",
                              loanCompany.CalculateInterestAmountForPeriod(1));
            Console.WriteLine("Mortgage individial account CalculateInterestAmountForPeriod for 6 month is ${0}",
                              mortgageIndividial.CalculateInterestAmountForPeriod(6));
            Console.WriteLine("Mortgage company account CalculateInterestAmountForPeriod for 7 month is ${0}",
                              mortgageCompany.CalculateInterestAmountForPeriod(7));
        }
Exemplo n.º 19
0
 private static void AddAccount()
 {
     Console.WriteLine("If you want: credit press 1, debit 2");
     if (Console.ReadLine().Equals("1"))
     {
         Console.WriteLine("How long you want repay a loan");
         Int32.TryParse(Console.ReadLine(), out int timeRepay);
         Console.WriteLine("How much you want to take");
         Decimal.TryParse(Console.ReadLine(), out decimal credit);
         CreditAccount creditAccount = new CreditAccount(0, timeRepay, credit);
         id                  = creditAccount.Id;
         account             = creditAccount;
         creditAccount.Send += str =>
         {
             Console.ForegroundColor = ConsoleColor.Yellow;
             Console.WriteLine(str);
             Console.ForegroundColor = ConsoleColor.Gray;
         };
         bank.Add(creditAccount);
         Console.WriteLine($"You succesed creat credit account with id{id}");
     }
     else
     {
         Console.WriteLine("How much you want to put");
         Decimal.TryParse(Console.ReadLine(), out decimal summ);
         DepositAccount depositAccount = new DepositAccount(summ, TypeDeposit.Bronze);
         id      = depositAccount.Id;
         account = depositAccount;
         bank.Add(depositAccount);
         Console.WriteLine($"You succesed creat deposit account with id{id}\n");
     }
 }
Exemplo n.º 20
0
        //public Income(Income i)
        //{
        //  Name = i.Name;
        //  PaydayAmount = i.PaydayAmount;
        //  PaydayFrequency = i.PaydayFrequency;
        //  DepositAccount = AccountBaseFactory.CopyAccountBase(i.DepositAccount);
        //  FirstDeposit = i.FirstDeposit;
        //  NextDeposit = i.NextDeposit;
        //  NumPaydaysPaidThisYear = i.NumPaydaysPaidThisYear;
        //}

        public void MakeDeposits(DateTime date)
        {
            var cal = new GregorianCalendar();

            if (date < NextDeposit)
            {
                return;
            }

            //todo: maybe make the deposit only happen if it's during the week
            while (NextDeposit <= date)
            {
                DepositAccount.NewCreditTransaction(new Transaction()
                {
                    Description = Name, Date = NextDeposit, Amount = PaydayAmount
                });
                NextDeposit = NextDeposit.AddDays((double)PaydayFrequency * 7);
                NumPaydaysPaidThisYear++;

                if (cal.GetYear(NextDeposit) > cal.GetYear(FirstDeposit))
                {
                    break; //passing into next year. for now keep this confined to a single year
                }
            }
        }
        public static void Main()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            DepositAccount dep = new DepositAccount(cust: Customer.Company, balance: 200, interestRate: 20);

            Console.WriteLine("Deposit account's Interest Amount: {0}", dep.GetInterestAmount(months: 6));

            // when balance is more than 1000
            dep.Deposit(900m);
            Console.WriteLine("Deposit account's Interest Amount: {0}\n", dep.GetInterestAmount(months: 6));

            // individual
            LoanAccount loanIndividual = new LoanAccount(cust: Customer.Individual, balance: 100, interestRate: 15);

            Console.WriteLine("Loan individual account's Interest Amount: {0}", loanIndividual.GetInterestAmount(months: 3));
            Console.WriteLine("Loan individual account's Interest Amount: {0}\n", loanIndividual.GetInterestAmount(months: 5));

            // company
            LoanAccount loanCompany = new LoanAccount(cust: Customer.Company, balance: 100, interestRate: 15);

            Console.WriteLine("Loan company account's Interest Amount: {0}", loanCompany.GetInterestAmount(months: 2));
            Console.WriteLine("Loan company account's Interest Amount: {0}\n", loanCompany.GetInterestAmount(months: 5));

            // individual
            MortgageAccount mortIndividual = new MortgageAccount(cust: Customer.Individual, balance: 350, interestRate: 5);

            Console.WriteLine("Mortgage individual account's Interest Amount: {0}", mortIndividual.GetInterestAmount(months: 7));
            Console.WriteLine("Mortgage individual account's Interest Amount: {0}\n", mortIndividual.GetInterestAmount(months: 8));

            // company
            MortgageAccount mortCompany = new MortgageAccount(cust: Customer.Company, balance: 20000, interestRate: 10);

            Console.WriteLine("Mortgage company account's Interest Amount: {0}", mortCompany.GetInterestAmount(months: 10));
            Console.WriteLine("Mortgage company account's Interest Amount: {0}\n", mortCompany.GetInterestAmount(months: 24));
        }
Exemplo n.º 22
0
        public async Task <IActionResult> AddPercents(int id)
        {
            try
            {
                IEnumerable <DepositContract> contracts = await _context.DepositContracts.Where(c => c.EndDate.CompareTo(DateTime.Today) >= 0).Include(c => c.Deposit).ToListAsync();

                Account frbAccount = await _context.Accounts.FirstAsync(a => a.Name == "frb");

                foreach (var contract in contracts)
                {
                    IEnumerable <DepositAccount> accounts = await _context.DepositAccounts.Where(da => da.DepositContractId == contract.Id).ToListAsync();

                    DepositAccount account        = accounts.First(a => !a.IsForPercents);
                    DepositAccount percentAccount = accounts.First(a => a.IsForPercents);
                    percentAccount.Credit += (account.Credit * contract.Deposit.Rate);
                    percentAccount.Saldo  += (account.Credit * contract.Deposit.Rate);
                    percentAccount.Debet  += (account.Credit * contract.Deposit.Rate);
                    frbAccount.Saldo      -= (account.Credit * contract.Deposit.Rate);
                    _context.Accounts.Update(percentAccount);
                }
                _context.Accounts.Update(frbAccount);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(RedirectToAction("Error", "Home"));
            }
        }
Exemplo n.º 23
0
        public BaseBankAccount CreateAccount(Client owner, Bank bank, double balance)
        {
            var account = new DepositAccount(owner, bank, balance);

            bank.SetProcents(account);
            return(account);
        }
Exemplo n.º 24
0
        public static void Main()
        {
            Bank bank = new Bank();

            Customer pesho  = new Customer("Pesho", CustomerType.Individual);
            Customer milko  = new Customer("Milko", CustomerType.Individual);
            Customer jichka = new Customer("jichka", CustomerType.Individual);

            Customer dell  = new Customer("Dell", CustomerType.Company);
            Customer hp    = new Customer("HP", CustomerType.Company);
            Customer apple = new Customer("Apple", CustomerType.Company);

            DepositAccount  peshoAccount  = new DepositAccount(pesho, 4300, 2.2m);
            LoanAccount     milkoAccount  = new LoanAccount(milko, 9999, 3.7m);
            MortgageAccount jichkaAccount = new MortgageAccount(jichka, 559, 1.2m);

            Account dellAccount  = new DepositAccount(dell, 17631782.4234m, 7.1m);
            Account hpAccount    = new LoanAccount(hp, 111111.1114m, 4.4m);
            Account appleAccount = new MortgageAccount(apple, 1888631782.4934234m, 11.1m);

            peshoAccount.Deposit(400.50m);
            peshoAccount.Withdraw(200);

            bank.AddAccount(peshoAccount);
            bank.AddAccount(milkoAccount);
            bank.AddAccount(jichkaAccount);
            bank.AddAccount(dellAccount);
            bank.AddAccount(hpAccount);
            bank.AddAccount(appleAccount);

            foreach (IAccount account in bank.Accounts)
            {
                Console.WriteLine($"{account} -- with interest for 23 months -> {account.CalculateInterest(23):F1}\n");
            }
        }
Exemplo n.º 25
0
        public static void Main()
        {
            ICustomer[] clients =
            {
                new IndividualCustomer("Dimitar Dimitrov"),
                new IndividualCustomer("Petar Ivanov"),
                new CompanyCustomer("Glavbulgarstroy OOD"),
                new CompanyCustomer("Monbat AD"),
            };

            var depositAccount = new DepositAccount(clients[0], 18000m, 0.004);
            var loanAccount = new LoanAccount(clients[1], 500m, 0.015);
            var mortgageAccount = new MortgageAccount(clients[0], 5000m, 0.009);
            var depositAccount2 = new DepositAccount(clients[2], 100000m, 0.010);
            var depositAccount3 = new DepositAccount(clients[3], 1200, 0.08);

            depositAccount.Withdraw(1000m);
            depositAccount2.Withdraw(500m);
            mortgageAccount.Deposit(15m);
            loanAccount.Deposit(100m);

            try
            {
                depositAccount.Withdraw(100000m);
            }
            catch (ArgumentException ex)
            {
                Console.Error.WriteLine(ex.Message);
            }

            Console.WriteLine(depositAccount2);
            Console.WriteLine(mortgageAccount);

            Console.WriteLine(loanAccount + string.Format(" Interest : {0:C}", loanAccount.CalculateInterest(12)));
        }
Exemplo n.º 26
0
    static void Main()
    {
        Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

        DepositAccount depAccountInd  = new DepositAccount(new Individual("Boyko Draganov", "9090909090"), 230m, 0.003m);
        DepositAccount depAccountComp = new DepositAccount(new Company("Barista", "999999999"), 13000m, 0.006m);

        MortgageAccount mortAccountInd  = new MortgageAccount(new Individual("Georgi Dimitrov", "9090909190"), 2300m, 0.005m);
        MortgageAccount mortAccountComp = new MortgageAccount(new Company("Sky", "999999999"), 35000m, 0.008m);

        LoanAccount loanAccountInd  = new LoanAccount(new Individual("Hani Kovachev", "9090909190"), 2300m, 0.005m);
        LoanAccount loanAccountComp = new LoanAccount(new Company("Scraper BG", "999999999"), 5000m, 0.002m);

        List <Account> accounts = new List <Account>()
        {
            depAccountInd, depAccountComp, mortAccountInd, mortAccountComp,
            loanAccountInd, loanAccountComp
        };


        foreach (var acc in accounts)
        {
            Console.WriteLine("I am {0}, I am owned by {1}, my current balance is \n{2} and the interest rate for {3} months is: {4:F2}", acc.GetType(),
                              acc.Customer.GetType(), acc.Balance, 3, acc.CalculateInterest(3));
            Console.WriteLine(new string('-', 50));
        }
        depAccountInd.DepositMoney(1000);
        depAccountInd.WithdrawMoney(130);

        Console.WriteLine("Deposit Account owned by Individual:\nMy current balance is:{0}, and my interest for 2 months is: {1:F2}",
                          depAccountInd.Balance, depAccountInd.CalculateInterest(2));
    }
Exemplo n.º 27
0
        static void Main()
        {
            ICustomer[] clients =
            {
                new IndividualCustomer("Kiril"),
                new IndividualCustomer("Nakov"),
                new CompanyCustomer("SoftUni"),
            };

            DepositAccount kirilDepositAccount = new DepositAccount(clients[0],888.354m,55);
            MortgageAccount nakovMortgageAccount = new MortgageAccount(clients[1],3415.77m,12);
            LoanAccount softUniLoanAccount = new LoanAccount(clients[2],56756.789m,3);

            kirilDepositAccount.Withdraw(123.77m);
            nakovMortgageAccount.Deposit(124.55m);
            softUniLoanAccount.Deposit(1779.33m);

            // Try false input
            try
            {
                kirilDepositAccount.Withdraw(1000m);
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine(kirilDepositAccount);
            Console.WriteLine(nakovMortgageAccount);
            Console.WriteLine(softUniLoanAccount + $"\nInterest rate: {softUniLoanAccount.CalculateInterest(3)}");

        }
Exemplo n.º 28
0
        public void OnlineDeposit(string money, string account, string address, string name, string email, string phone, string supplement, string platformType, string orderNumber, string billno)
        {
            DepositAccount deposit = new DepositAccount
            {
                DepositMoney  = money,
                AccountId     = account,
                Address       = address,
                Name          = name,
                Email         = email,
                Phone         = phone,
                Explanation   = supplement,
                OrderNumber   = orderNumber,
                ZipCode       = "",
                PlatformType  = platformType,
                AttachData    = "",
                BankReturnMsg = "",
                Billno        = billno,
                Currency_Type = "",
                DepositId     = "",
                IPSBillno     = "",
                Mercode       = "",
                OrderAmount   = money,
                OrderDate     = "",
                Retencodetype = "",
                SignatureInfo = "",
                SymbolSuccess = "N"
            };

            Session["DepositAccount"] = deposit;
            Session.Timeout           = 300;
            DepositAccount acc = new DepositAccountBll().AddDepositAccount(deposit);
        }
Exemplo n.º 29
0
        private static void CreateAccount(Customer customer)
        {
            string accountType;
            double startingBalance;
            string accountNumber = "ABC0000";

            do
            {
                Console.Write("Enter Account Type(Mortgage/Loan/Deposit): ");
                accountType = Console.ReadLine();
            }while (!String.Equals(accountType, "Mortgage") && !String.Equals(accountType, "Loan") && !String.Equals(accountType, "Deposit"));

            Console.Write("Enter Starting Balance: ");
            startingBalance = Convert.ToDouble(Console.ReadLine());
            accountNumber   = accountNumber + _rand.Next(5, 10);
            if (String.Equals(accountType, "Mortgage"))
            {
                var mortgageAccount = new MortgageAccount(customer, startingBalance, accountNumber);
                _accounts.Add(mortgageAccount);
            }
            else if (String.Equals(accountType, "Loan"))
            {
                var loanAccount = new LoanAccount(customer, startingBalance, accountNumber);
                _accounts.Add(loanAccount);
            }
            else
            {
                var depoAccount = new DepositAccount(customer, startingBalance, accountNumber);
                _accounts.Add(depoAccount);
            }
        }
Exemplo n.º 30
0
        public static void Main()
        {
            ICustomer[] clients =
            {
                new IndividualCustomer("Pesho"),
                new IndividualCustomer("Gosho"),
                new CompanyCustomer("Soft Uni LTD"),
                new CompanyCustomer("Manchester United FC"),
            };

            var depositAcc = new DepositAccount(clients[0], 8955.33m, 0.005);
            var loanAcc = new LoanAccount(clients[1], 500m, 0.002);
            var mortgageAcc = new MortgageAccount(clients[2], 5m, 0.009);
            var depositAcc2 = new DepositAccount(clients[3], 159, 0.08);

            depositAcc.Withdraw(6000m);
            depositAcc2.Withdraw(54.22m);
            mortgageAcc.Deposit(15m);
            loanAcc.Deposit(5559.66m);

            try
            {
                depositAcc.Withdraw(500000000m);
            }
            catch (ArgumentException ex)
            {
                Console.Error.WriteLine(ex.Message);
            }

            Console.WriteLine(depositAcc2);
            Console.WriteLine(mortgageAcc);

            Console.WriteLine(loanAcc + $" Interest rate: {loanAcc.CalculateIntereset(12):C}");
        }
Exemplo n.º 31
0
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            DepositAndTransferViewModel depositAndTransferViewModel = new DepositAndTransferViewModel();
            DepositAccount depositAccount = await _context.DepositAccounts.FindAsync(id);

            depositAndTransferViewModel.DepositAccountId = depositAccount.DepositAccountId;
            depositAndTransferViewModel.Donor            = depositAccount.Donor;
            depositAndTransferViewModel.DepositCode      = depositAccount.DepositCode;
            depositAndTransferViewModel.DepositDate      = depositAccount.DepositDate;
            depositAndTransferViewModel.DepositType      = depositAccount.DepositType;
            depositAndTransferViewModel.DepositAmount    = depositAccount.DepositAmount;
            depositAndTransferViewModel.Balance          = depositAccount.Balance;
            //depositAndTransferViewModel.Balance = depositAccount.DepositAmount - _context.TransferAccounts.Where(c=>c.DepositAccountId == depositAccount.DepositAccountId).Sum(s=>s.TransferAmount);
            depositAndTransferViewModel.TransferAccounts =
                _context.TransferAccounts.Where(d => d.DepositAccountId == depositAccount.DepositAccountId).ToList();

            if (depositAccount == null)
            {
                return(NotFound());
            }
            return(View(depositAndTransferViewModel));
        }
Exemplo n.º 32
0
    static void Main()
    {
        Bank bank = new Bank();

        DepositAccount depAccC = new DepositAccount(new Company(), 300M, 0.4M);
        DepositAccount depAccI = new DepositAccount(new Individual(), 1000M, 0.4M);

        LoanAccount loanAccC = new LoanAccount(new Company(), 1000M, 0.4M);
        LoanAccount loanAccI = new LoanAccount(new Individual(), 1000M, 0.4M);

        MortgageAccount mortAccC = new MortgageAccount(new Company(), 1000M, 0.4M);
        MortgageAccount mortAccI = new MortgageAccount(new Individual(), 1000M, 0.4M);

        bank.AddAccount(depAccC);
        bank.AddAccount(depAccI);
        bank.AddAccount(loanAccC);
        bank.AddAccount(loanAccI);
        bank.AddAccount(mortAccC);
        bank.AddAccount(mortAccI);

        foreach (var acc in bank.Accounts)
        {
            Console.WriteLine(acc.CalculateInterestAmount(12));
        }
    }
Exemplo n.º 33
0
        static void Main(string[] args)
        {
            Individual kiro = new Individual("Kiro");
            Individual ivan = new Individual("Ivan");
            Company    sap  = new Company("SAP");

            DepositAccount  kiroAccount = new DepositAccount(kiro, 1112, 0.2m);
            LoanAccount     ivanAccount = new LoanAccount(ivan, 2222, 0.29m);
            MortgageAccount sapAccount  = new MortgageAccount(sap, 3333, 0.23m);

            List <Account> accounts = new List <Account>()
            {
                kiroAccount,
                ivanAccount,
                sapAccount
            };

            foreach (var account in accounts)
            {
                Console.WriteLine(account);
            }

            Console.WriteLine(kiroAccount.CalculateInterestrate(4));
            Console.WriteLine(sapAccount.CalculateInterestrate(55));
            sapAccount.Deposit(4141);
            kiroAccount.Withdraw(333);

            foreach (var account in accounts)
            {
                Console.WriteLine(account);
            }
        }
Exemplo n.º 34
0
    static void Main()
    {
        Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

        Customer depositAccountCustomer = new IndividualCustomer(
            "2343PJ34752",
            "William",
            "Harris",
            "1 Microsoft Way, Redmond, WA",
            "1-888-553-6562");

        DepositAccount depositAccount = new DepositAccount(
            depositAccountCustomer,
            2500,
            1.0825M,
            12);

        Customer loanAccountCustomer = new CorporateCustomer(
            "89BPQ123YJ0",
            "Oracle Corporation",
            "500 Oracle Parkway, Redwood Shores, Redwood City, California, United States",
            "1-981-717-9366");

        Account loanAccount = new LoanAccount(
            loanAccountCustomer,
            1000000000,
            1.0931M,
            24);

        Customer mortgageLoanAccountCustomer = new IndividualCustomer(
            "97A20LX3YJU",
            "Ginni",
            "Rometty",
            "Armonk, New York, U.S.",
            "1-129-342-3817");

        Account mortgageLoanAccount = new MortgageLoanAccount(
            mortgageLoanAccountCustomer,
            300000,
            1.0875M,
            36);

        decimal depositInterest = depositAccount.CalculateInterest(3);

        Console.WriteLine("Deposit account interest: {0:C2}", depositInterest);

        depositAccount.Deposit(459.76M);
        depositAccount.Withdraw(400.76M);

        Console.WriteLine("Deposit account balance: {0:C2}", depositAccount.Balance);

        decimal loanInterest = loanAccount.CalculateInterest(10);

        Console.WriteLine("Loan account interest: {0:C2}", loanInterest);

        decimal mortgageLoanInterest = mortgageLoanAccount.CalculateInterest(10);

        Console.WriteLine("Mortgage loan account interest: {0:C2}", mortgageLoanInterest);
    }
        static void Main()
        {
            // Making instances of all types of accounts with the two types of customers
            DepositAccount first = new DepositAccount(new IndividualCustomer("Jimmy Hendrix"), 1500, 5);
            DepositAccount second = new DepositAccount(new CompanyCustomer("Jimmy Hendrix"), 500, 5);
            LoanAccount third = new LoanAccount(new IndividualCustomer("Jimmy Hendrix"), 4000, 7);
            LoanAccount fourth = new LoanAccount(new CompanyCustomer("Jimmy Hendrix"), 50000, 3);
            MortgageAccount fifth = new MortgageAccount(new IndividualCustomer("Jimmy Hendrix"), 34000, 4);
            MortgageAccount sixth = new MortgageAccount(new CompanyCustomer("Jimmy Hendrix"), 19000, 9);
            // Testing the DepositMoney, WithDrawMoney and CalculateInterest methods for all account types
            Console.WriteLine("INDIVIDUAL DEPOSIT ACCOUNT:");
            Console.WriteLine("Balance: {0}", first.Balance);
            first.DepositMoney(10);
            Console.WriteLine("Balance after deposit: {0}", first.Balance);
            first.WithDrawMoney(150);
            Console.WriteLine("Balance after withdraw: {0}", first.Balance);
            Console.WriteLine("Calculate interest: {0}", first.CalculateInterest(5));
            Console.WriteLine();
            Console.WriteLine("CUSTOMER DEPOSIT ACCOUNT: ");
            Console.WriteLine("Balance: {0}", second.Balance);
            second.DepositMoney(2000);
            Console.WriteLine("Balance after deposit: {0}", second.Balance);
            second.WithDrawMoney(1800);
            Console.WriteLine("Balance after withdraw: {0}", second.Balance);
            Console.WriteLine("Calculate interest: {0}", second.CalculateInterest(9));
            Console.WriteLine();
            Console.WriteLine("INDIVIDUAL LOAN ACCOUNT:");
            Console.WriteLine("Balance: {0}", third.Balance);
            third.DepositMoney(60);
            Console.WriteLine("Balance after deposit: {0}", third.Balance);
            Console.WriteLine("Calculate interest: {0}", third.CalculateInterest(7));
            Console.WriteLine();
            Console.WriteLine("CUSTOMER LOAN ACCOUNT:");
            Console.WriteLine("Balance: {0}", fourth.Balance);
            fourth.DepositMoney(60);
            Console.WriteLine("Balance after deposit: {0}", fourth.Balance);
            Console.WriteLine("Calculate interest: {0}", fourth.CalculateInterest(9));
            Console.WriteLine();
            Console.WriteLine("INDIVIDUAL MORTGAGE ACCOUNT:");
            Console.WriteLine("Balance: {0}", fifth.Balance);
            fifth.DepositMoney(100);
            Console.WriteLine("Balance after deposit: {0}", fifth.Balance);
            Console.WriteLine("Calculate interest: {0}", fifth.CalculateInterest(6));
            Console.WriteLine();
            Console.WriteLine("CUSTOMER MORTGAGE ACCOUNT:");
            Console.WriteLine("Balance: {0}", sixth.Balance);
            sixth.DepositMoney(100);
            Console.WriteLine("Balance after deposit: {0}", sixth.Balance);
            Console.WriteLine("Calculate interest: {0}", sixth.CalculateInterest(11));

            // Testing the Bank class and the AddAccount method
            Bank newBank = new Bank(LoadList());
            Console.WriteLine();
            newBank.AddAccount(new DepositAccount(new IndividualCustomer("Joe Rogan"), 780, 3));
            Console.WriteLine("Type of customer: " + newBank.Accounts[6].Customer.GetType().Name);
            Console.WriteLine("Name: " + newBank.Accounts[6].Customer.Name);
            Console.WriteLine("Balance: " + newBank.Accounts[6].Balance);
            Console.WriteLine("Interest rate: " + newBank.Accounts[6].InterestRate);
        }
Exemplo n.º 36
0
            public async void Should_Return_BadRequest_If_Amount_Less_Than_Equal_Zero()
            {
                var accountId      = Guid.NewGuid();
                var depositAccount = new DepositAccount(0);

                var result = (ObjectResult)await _accountsController.Deposit(accountId, depositAccount);

                result.StatusCode.Should().Be((int)HttpStatusCode.OK);
            }
        public void WithdrawFromDepositAccount_CannotWithdrawNegativeAmount()
        {
            // Arrange
            Individual     personToWithdraw = new Individual();
            DepositAccount deposit          = new DepositAccount(personToWithdraw, 0.3);

            // Act and Assert
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => deposit.Withdraw(-2));
        }
        public void MakeDepositToDepositAccount_CannotDepositNegativeAmount()
        {
            // Arrange
            Individual     personToMakeDeposit = new Individual();
            DepositAccount deposit             = new DepositAccount(personToMakeDeposit, 0.3);

            // Act and Assert
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => deposit.MakeDeposit(-2));
        }
        public void GetInterestAmountForDepositAccount_MonthsCannotBeLessThanZero()
        {
            // Arrange
            Individual     person  = new Individual();
            DepositAccount deposit = new DepositAccount(person, 0.3);

            // Act and Assert
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => deposit.GetInterestAmount(-2));
        }
Exemplo n.º 40
0
        /// <summary>
        /// Method for creating deposit account
        /// </summary>
        /// <returns></returns>
        private IDepositAccount createDepositAccount()
        {
            int        period          = Convert.ToInt32(txtPeriod.Text);
            int        unitNumPeriod   = Convert.ToInt32(txtUnitPeriod.Text);
            decimal    percent         = Convert.ToDecimal(txtPercent.Text);
            int        unitNumInterest = Convert.ToInt32(txtUnitInterestRate.Text);
            UnitOfTime unit;

            switch (unitNumPeriod)
            {
            case 0: unit = UnitOfTime.Day;
                break;

            case 1: unit = UnitOfTime.Mounth;
                break;

            case 2: unit = UnitOfTime.Year;
                break;

            default: unit = UnitOfTime.Day;
                break;
            }

            TimePeriod tp = new TimePeriod();

            tp.Period = period;
            tp.Unit   = unit;

            switch (unitNumInterest)
            {
            case 0: unit = UnitOfTime.Day;
                break;

            case 1: unit = UnitOfTime.Mounth;
                break;

            case 2: unit = UnitOfTime.Year;
                break;

            default: unit = UnitOfTime.Day;
                break;
            }

            InterestRate ir = new InterestRate();

            ir.Percent = percent;
            ir.Unit    = unit;

            DateTime start = dtpStart.Value;
            DateTime end   = dtpEnd.Value;

            ITransactionAccount ta = createTransactionAccount();

            IDepositAccount DepAccount = new DepositAccount(ta.Currency, tp, ir, start, end, ta as TransactionAccount);

            return(DepAccount);
        }
Exemplo n.º 41
0
    static void Main()
    {
        Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

        Customer depositAccountCustomer = new IndividualCustomer(
            "2343PJ34752",
            "William",
            "Harris",
            "1 Microsoft Way, Redmond, WA",
            "1-888-553-6562");

        DepositAccount depositAccount = new DepositAccount(
            depositAccountCustomer,
            2500,
            1.0825M,
            12);

        Customer loanAccountCustomer = new CorporateCustomer(
            "89BPQ123YJ0",
            "Oracle Corporation",
            "500 Oracle Parkway, Redwood Shores, Redwood City, California, United States",
            "1-981-717-9366");

        Account loanAccount = new LoanAccount(
            loanAccountCustomer,
            1000000000,
            1.0931M,
            24);

        Customer mortgageLoanAccountCustomer = new IndividualCustomer(
            "97A20LX3YJU",
            "Ginni",
            "Rometty",
            "Armonk, New York, U.S.",
            "1-129-342-3817");

        Account mortgageLoanAccount = new MortgageLoanAccount(
            mortgageLoanAccountCustomer,
            300000,
            1.0875M,
            36);

        decimal depositInterest = depositAccount.CalculateInterest(3);
        Console.WriteLine("Deposit account interest: {0:C2}", depositInterest);

        depositAccount.Deposit(459.76M);
        depositAccount.Withdraw(400.76M);

        Console.WriteLine("Deposit account balance: {0:C2}", depositAccount.Balance);

        decimal loanInterest = loanAccount.CalculateInterest(10);
        Console.WriteLine("Loan account interest: {0:C2}", loanInterest);

        decimal mortgageLoanInterest = mortgageLoanAccount.CalculateInterest(10);
        Console.WriteLine("Mortgage loan account interest: {0:C2}", mortgageLoanInterest);
    }
Exemplo n.º 42
0
    static void Main()
    {
        Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

        Customer depositAccountCustomer = new IndividualCustomer(
            "123456789AA",
            "Pesho",
            "Peshov",
            "Sofia, Bulgaria, Tzarigradsko shose 2",
            "555-123-123");

        DepositAccount depositAccount = new DepositAccount(
            depositAccountCustomer,
            2000,
            0.1234M,
            36);

        Customer loanAccountCustomer = new CorporateCustomer(
            "123456789AB",
            "Oracle Corporation",
            "Sofia, Bulgaria, Tzarigradsko shose 20",
            "555-123-321");

        Account loanAccount = new LoanAccount(
            loanAccountCustomer,
            9000000000,
            0.1234M,
            24);

        Customer mortgageLoanAccountCustomer = new IndividualCustomer(
            "223456789AA",
            "Ginni",
            "Rometty",
            "Sofia, Bulgaria, Tzarigradsko shose 22",
            "555-321-321");

        Account mortgageLoanAccount = new MortgageLoanAccount(
            mortgageLoanAccountCustomer,
            990000,
            0.1234M,
            12);

        decimal depositInterest = depositAccount.CalculateInterest(3);
        Console.WriteLine("Deposit account interest: {0:C2}", depositInterest);

        depositAccount.Deposit(459.76M);
        depositAccount.Withdraw(400.76M);

        Console.WriteLine("Deposit account balance: {0:C2}", depositAccount.Balance);

        decimal loanInterest = loanAccount.CalculateInterest(10);
        Console.WriteLine("Loan account interest: {0:C2}", loanInterest);

        decimal mortgageLoanInterest = mortgageLoanAccount.CalculateInterest(10);
        Console.WriteLine("Mortgage loan account interest: {0:C2}", mortgageLoanInterest);
    }
        public static void Main()
        {
            LoanAccount lAccount = new LoanAccount("Gosho Goshev", CustomerTypes.individual, 23423, 3);
            DepositAccount dAccount = new DepositAccount("Company", CustomerTypes.company, 44321, 1.75m);
            MortgageAccount mAccount = new MortgageAccount("Any individual", CustomerTypes.individual, -234, 2.99m);

            Console.WriteLine("Loan account interest amont for 5 months: {0}", lAccount.InterestAmount(5));
            Console.WriteLine("Deposit account interest amont for 3 months: {0}", dAccount.InterestAmount(3));
            Console.WriteLine("Mortgage account interest amont for 7 months: {0}", mAccount.InterestAmount(7));
        }
Exemplo n.º 44
0
        private bool CanDepositExecute(object obj)
        {
            DepositAccount account = StaticManager.CurrentCard as DepositAccount;

            if (account != null)
            {
                return(DateTime.Today >= account.AvailableDate);
            }
            return(true);
        }
Exemplo n.º 45
0
    static void Main()
    {
        Customer customer = Customer.Individual;
          DepositAccount account = new DepositAccount(customer, 1500, 5);

          Console.WriteLine(account.CalculateInterest(5));

          account.DepositMoney(2500);
          account.WithDraw(500);
          Console.WriteLine(account.Balance);
    }
Exemplo n.º 46
0
        private static void TestInterestCalculations(LoanAccount a, MortgageAccount b, MortgageAccount c, DepositAccount d,
            DepositAccount e)
        {
            List<ICalculateInterest> accountInterests = new List<ICalculateInterest>() {a, b, c, d, e};

            foreach (var account in accountInterests)
            {
                Console.WriteLine("{0}, balance {1:F2}", account.GetType().Name, account.CalculateInterest(24));
            }
            Console.WriteLine();
        }
    static void Main()
    {
        LoanAccount loanAcc = new LoanAccount(new Individual("Georgi", 28, "1122334455"), 1000, 7);
        Console.WriteLine(loanAcc.CalculateInterest(6));

        DepositAccount depositAcc = new DepositAccount(new Company("SoftUni Ltd.", 1, "1122334455"), 1000, 7);
        Console.WriteLine(depositAcc.CalculateInterest(6));

        MortgageAccount mortgageAcc = new MortgageAccount(new Individual("Pesho", 20, "1122334455"), 1000, 7);
        Console.WriteLine(mortgageAcc.CalculateInterest(6));
    }
Exemplo n.º 48
0
        static void Main(string[] args)
        {
            Customer cust = new IndividualCustomer("Pesho");
            //Customer cust = new CompanyCustomer("Pesho");

            //Account acc = new LoanAccount(cust, 100, 0.06M);
            //Account acc = new MortgageAccount(cust, 100, 0.06M);
            Account acc = new DepositAccount(cust, 1200, 0.06M);

            Console.WriteLine(acc.CalculateInterest(12));
        }
Exemplo n.º 49
0
 public void Setup()
 {
     _bank           = new Bank("Tinkoff Bank");
     _client         = Client.Builder("Fredi", "Kats").SetAddress("Лесной пр-кт, д. 9").SetPassport("1234567890").GetClient();
     _debitAccount   = new DebitAccount(_client, 10000, 2);
     _depositAccount = new DepositAccount(_client, 5000, TimeSpan.FromSeconds(5));
     _creditAccount  = new CreditAccount(_client, 2000, 4000, 2);
     _bank.AddClient(_client);
     _bank.AddAccountToClient(_client, _debitAccount);
     _bank.AddAccountToClient(_client, _depositAccount);
     _bank.AddAccountToClient(_client, _creditAccount);
 }
Exemplo n.º 50
0
    static void Main(string[] args)
    {
        //A bank holds different types of accounts for its customers: deposit accounts, loan
        //accounts and mortgage accounts. Customers could be individuals or companies.
        //All accounts have customer, balance and interest rate (monthly based). Deposit accounts
        //are allowed to deposit and with draw money. Loan and mortgage accounts can only deposit money.
        //All accounts can calculate their interest amount for a given period (in months). In the
        //common case its is calculated as follows: number_of_months * interest_rate.
        //Loan accounts have no interest for the first 3 months if are held by individuals and for the
        //first 2 months if are held by a company.
        //Deposit accounts have no interest if their balance is positive and less than 1000.
        //Mortgage accounts have ½ interest for the first 12 months for companies and no interest for the
        //first 6 months for individuals.
        //Your task is to write a program to model the bank system by classes and interfaces. You should
        //identify the classes, interfaces, base classes and abstract actions and implement the calculation
        //of the interest functionality through overridden methods.

        //Make two customers - one company and one individual
        Company kaBar = new Company("KaBar");
        Individual peter = new Individual("Peter Petrov");

        //Make deposite account for individual and company and test the account functionalities
        DepositAccount peterDepositAcount = new DepositAccount(peter, 500m, 0.05m);
        DepositAccount kaBarDepositAcount = new DepositAccount(kaBar, 500m, 0.05m);
        peterDepositAcount.Draw(200m);
        Console.WriteLine(peterDepositAcount.Balance);
        peterDepositAcount.AddDeposit(200);
        Console.WriteLine(peterDepositAcount.Balance);

        Console.WriteLine("The {0} of the {1}-{2} have interest amount for next six mounths: {3} "
            , peterDepositAcount.GetType(), peterDepositAcount.Customer.GetType(), peterDepositAcount.Customer.Name, peterDepositAcount.InterestAmountForPeriod(6));
        Console.WriteLine("The {0} of the {1}-{2} have interest amount for next six mounths: {3} "
            , kaBarDepositAcount.GetType(), kaBarDepositAcount.Customer.GetType(), kaBarDepositAcount.Customer.Name, kaBarDepositAcount.InterestAmountForPeriod(6));
        Console.WriteLine("--------------------------------------------------------------------");

        //Make loan account for individual and company and test the account functionalities
        LoanAccount peterLoanAccount = new LoanAccount(peter, 500m, 0.05m);
        Console.WriteLine("The {0} of the {1}-{2} have interest amount for next six mounths: {3} "
            , peterLoanAccount.GetType(), peterLoanAccount.Customer.GetType(), peterLoanAccount.Customer.Name, peterLoanAccount.InterestAmountForPeriod(6));

        LoanAccount kaBarLoanAccount = new LoanAccount(kaBar, 500m, 0.05m);
        Console.WriteLine("The {0} of the {1}-{2} have interest amount for next six mounths: {3} "
            , kaBarLoanAccount.GetType(), kaBarLoanAccount.Customer.GetType(), kaBarLoanAccount.Customer.Name, kaBarLoanAccount.InterestAmountForPeriod(6));
        Console.WriteLine("--------------------------------------------------------------------");

        //Make Mortage account for individual and company and test the account functionalities
        MortageAccount peterMortageAccount = new MortageAccount(peter, 500m, 0.05m);
        Console.WriteLine("The {0} of the {1}-{2} have interest amount for next two years: {3} "
            , peterMortageAccount.GetType(), peterMortageAccount.Customer.GetType(), peterMortageAccount.Customer.Name, peterMortageAccount.InterestAmountForPeriod(24));
        MortageAccount kaBarMortageAccount = new MortageAccount(kaBar, 500m, 0.05m);
        Console.WriteLine("The {0} of the {1}-{2} have interest amount for next two years: {3} "
            , kaBarMortageAccount.GetType(), kaBarMortageAccount.Customer.GetType(), kaBarMortageAccount.Customer.Name, kaBarMortageAccount.InterestAmountForPeriod(24));
    }
Exemplo n.º 51
0
        public void TestMethod1()
        {
            //arrange
            Account CurrentAccount1 = new DepositAccount("Рогатнев", "Сергей");
            decimal AddSum          = 1000;

            //act
            CurrentAccount1.DepositMoney(AddSum);

            //assert
            Assert.AreEqual(AddSum, CurrentAccount1.Amount);
        }
Exemplo n.º 52
0
        private static void TestWithdrawFunctionality(DepositAccount d, DepositAccount e)
        {
            List<IWithdrawMoney> accountWithdraws = new List<IWithdrawMoney>() {d, e};

            foreach (var withdraw in accountWithdraws)
            {
                withdraw.WithdrawMoney(120);

                Account acc = (Account) withdraw;
                Console.WriteLine("{0}, balance {1:F2}", acc.GetType().Name, acc.Balance);
            }
        }
Exemplo n.º 53
0
        static void Main()
        {
            var customer = new IndividualCustomer("Pesho", "Sofia");
            var bankAccount = new DepositAccount(customer, 30.4);

            bankAccount.Deposit(2000M);
            Console.WriteLine("Current balance: {0}",bankAccount.Balance);
            Console.WriteLine("Interest amount: {0}", bankAccount.GetInterestAmount(23));

            bankAccount.Withdraw(160.50M);
            Console.WriteLine("Current balance: {0}",bankAccount.Balance);
        }
Exemplo n.º 54
0
    static void Main()
    {
        //Making customers - individual and company
            CompanyCustomer ood = new CompanyCustomer("OOD");
            IndividualCustomer samuel = new IndividualCustomer("Samuel L. Jackson");

            //Testing some stuff
            DepositAccount samuelDepositAccount = new DepositAccount(samuel , 10000m, 100m);
            DepositAccount oodDepositAccount = new DepositAccount(ood, 10000m, 100m);
            Console.WriteLine("{1} has {0} money.", samuelDepositAccount.Balance, samuelDepositAccount.Customer.Name);
            samuelDepositAccount.WithDrawMoney(500m);
            Console.WriteLine("After we with draw some money he has {0} money." , samuelDepositAccount.Balance);
            samuelDepositAccount.AddDeposit(200m);
            Console.WriteLine("After we deposit some money he has " + samuelDepositAccount.Balance);

            Console.WriteLine();
            Console.WriteLine();

            //Testing the deposit account
            Console.WriteLine("Testing the deposit account:");
            Console.WriteLine("----------------------------");
            Console.WriteLine("The {0} of {2} who is a {1} has interest amount for next 6 mounths: {3} "
            , samuelDepositAccount.GetType(), samuelDepositAccount.Customer.GetType(), samuelDepositAccount.Customer.Name, samuelDepositAccount.InterestAmountForPeriod(6));
            Console.WriteLine("The {0} of {2} who is a {1} has interest amount for next 6 mounths: {3} "
                , oodDepositAccount.GetType(), oodDepositAccount.Customer.GetType(), oodDepositAccount.Customer.Name, oodDepositAccount.InterestAmountForPeriod(6));
            Console.WriteLine();
            Console.WriteLine();

            //Testing the loan account
            Console.WriteLine("Testing the loan account:");
            Console.WriteLine("----------------------------");
            LoanAccount samuelLoanAccount = new LoanAccount(samuel, 10000m, 100m);
            Console.WriteLine("The {0} of {2} who is a {1} has interest amount for next 6 mounths: {3} "
                , samuelLoanAccount.GetType(), samuelLoanAccount.Customer.GetType(), samuelLoanAccount.Customer.Name, samuelLoanAccount.InterestAmountForPeriod(6));

            LoanAccount oodLoanAccount = new LoanAccount(ood, 10000m, 100m);
            Console.WriteLine("The {0} of {2} who is a {1} has interest amount for next 6 mounths: {3} "
                , oodLoanAccount.GetType(), oodLoanAccount.Customer.GetType(), oodLoanAccount.Customer.Name, oodLoanAccount.InterestAmountForPeriod(6));
            Console.WriteLine();
            Console.WriteLine();

            //Testing the mortage account
            Console.WriteLine("Testing the mortage account:");
            Console.WriteLine("----------------------------");
            MortageAccount samuelMortageAccount = new MortageAccount(samuel, 10000m, 100m);
            Console.WriteLine("The {0} of {2} who is a {1} has interest amount for next 24 mounths: {3} "
                , samuelMortageAccount.GetType(), samuelMortageAccount.Customer.GetType(), samuelMortageAccount.Customer.Name, samuelMortageAccount.InterestAmountForPeriod(24));
            MortageAccount oodMortageAccount = new MortageAccount(ood, 10000m, 100m);
            Console.WriteLine("The {0} of {2} who is a {1} has interest amount for next 24 mounths: {3} "
                , oodMortageAccount.GetType(), oodMortageAccount.Customer.GetType(), oodMortageAccount.Customer.Name, oodMortageAccount.InterestAmountForPeriod(24));
    }
Exemplo n.º 55
0
        static void Main()
        {
            BankAccount Ivan = new DepositAccount(Customer.Individual, 975.34m, 5.3m);
            Console.WriteLine(Ivan.CalculateInterestForGivenMonth(12).ToString("f2"));
            Console.WriteLine();

            BankAccount Peter = new DepositAccount(Customer.Individual, 1637.94m, 1.3m);
            Console.WriteLine(Peter.CalculateInterestForGivenMonth(12).ToString("f2"));
            Console.WriteLine();

            BankAccount Misho = new MortgageAccount(Customer.Individual, 4457.23m, 7.3m);
            Console.WriteLine(Misho.CalculateInterestForGivenMonth(12).ToString("f2"));
            Console.WriteLine();
        }
Exemplo n.º 56
0
        private static void TestDepositFunctionality(LoanAccount a, MortgageAccount b, MortgageAccount c, DepositAccount d,
            DepositAccount e)
        {
            List<IDepositMoney> accountDeposits = new List<IDepositMoney>() {a, b, c, d, e};

            foreach (var deposit in accountDeposits)
            {
                deposit.DepositMoney(1100.50m);

                Account acc = (Account) deposit;
                Console.WriteLine("{0}, balance {1:F2}", acc.GetType().Name, acc.Balance);
            }
            Console.WriteLine();
        }
    static void Main(string[] args)
    {
        DepositAccount dep = new DepositAccount(Customers.companies, 2154);
        dep.Deposit(12);
        Console.WriteLine(dep.Balance);

        dep.CalculateInterestAmount(8);
        Console.WriteLine(dep.InterestAmount);

        MortgageAccount mort = new MortgageAccount(Customers.individuals, 56);
        mort.CalculateInterestAmount(2);
        Console.WriteLine(mort.InterestAmount);

        dep.Deposit(12313);
        Console.WriteLine(dep.Balance);

    }
Exemplo n.º 58
0
        static void Main()
        {
            var bajPesho = Customer.Individual;
            var leliaMarche = Customer.Individual;
            var mrAnderson = Customer.Individual;

            var google = Customer.Company;
            var microsoft = Customer.Company;
            var facebook = Customer.Company;

            var bajPeshoAccount = new DepositAccount(bajPesho, 200, 7);
            var leliaMarcheAccount = new MortgageAccount(leliaMarche, 200, 7);
            var mrAndersonAccount = new LoanAccount(mrAnderson, 200, 7);

            var googleAccount = new DepositAccount(google, 200, 7);
            var microsoftAccount = new MortgageAccount(microsoft, 200, 7);
            var facebookAccount = new LoanAccount(facebook, 200, 7);

            googleAccount.Withdraw(100);
               // Console.WriteLine(googleAccount.Balance);
            facebookAccount.Deposit(100);
               // Console.WriteLine(facebookAccount.Balance);

            var accounts = new List<IAccount>()
            {
                googleAccount,
                microsoftAccount,
                facebookAccount,
                bajPeshoAccount,
                leliaMarcheAccount,
                mrAndersonAccount
            };

            var sortedAccounts = accounts.OrderByDescending(account => account.Balance);

            foreach (var account in sortedAccounts)
            {
                decimal interestFirstMonths = account.CalculateInterest(3);
                decimal interest = account.CalculateInterest(13);

                Console.WriteLine("customer: {0} - balance: {1}; first months interest: {2}; interest: {3}"
                    , account.Customer, account.Balance, interestFirstMonths, interest);
            }
        }
    static void Main()
    {
        Console.WriteLine("----------Loan Account(Company)----------\n");
        LoanAccount accountOne = new LoanAccount(CustomerType.Company, 50000, 500, 24);
        accountOne.CalculateInterest();
        accountOne.Deposit(500);

        Console.WriteLine("\n\n----------Loan Account(Individual)----------\n");
        LoanAccount accountTwo = new LoanAccount(CustomerType.Individual, 50000, 500, 24);
        accountTwo.CalculateInterest();
        accountTwo.Deposit(500);

        Console.WriteLine("\n\n----------Mortage Account(Company)----------\n");
        MortageAccount accountThree = new MortageAccount(CustomerType.Company, 100000, 1000, 36);
        accountThree.CalculateInterest();
        accountThree.Deposit(10000);

        Console.WriteLine("\n\n----------Mortage Account(Individual)----------\n");
        MortageAccount accountFour = new MortageAccount(CustomerType.Individual, 100000, 1000, 36);
        accountFour.CalculateInterest();
        accountFour.Deposit(10000);

        Console.WriteLine("\n\n----------Deposit Account(Company)----------\n");
        DepositAccount accountFive = new DepositAccount(CustomerType.Company, 500000, 5000, 24);
        accountFive.CalculateInterest();
        accountFive.Deposit(100000);
        accountFive.Withdraw(200000);

        Console.WriteLine("\n\n----------Deposit Account(Individual)----------\n");
        DepositAccount accountSix = new DepositAccount(CustomerType.Individual, 500000, 5000, 24);
        accountSix.CalculateInterest();
        accountSix.Deposit(100000);
        accountSix.Withdraw(200000);

        Console.WriteLine("\n\n----------Deposit Account(Balance under 1000)----------\n");
        DepositAccount accountSeven = new DepositAccount(CustomerType.Individual, 500, 50, 6);
        accountSeven.CalculateInterest();
        accountSeven.Deposit(50);
        accountSeven.Withdraw(150);

        Console.WriteLine("\n\n\n");
    }
Exemplo n.º 60
-1
        public static void Main()
        {
            Bank bank = new Bank("SoftUni Bank");
            var e = bank.Accounts;
            foreach (var account in e)
            {
                Console.WriteLine(account);
            }

            try
            {
                Individual clientOne = new Individual("Pencho Pitankata", "Neyde", "1212121230");
                Company clientTwo = new Company("SoftUni", "Hadji Dimitar", "831251119", true);
                DepositAccount depositOne = new DepositAccount(clientOne, 5, 10000);
                DepositAccount depositTwo = new DepositAccount(clientOne, 2, 100, new DateTime(2000, 01, 01));
                DepositAccount depositThree = new DepositAccount(clientOne, 2, 10000, new DateTime(2008, 01, 01));
                LoanAccount loanOne = new LoanAccount(clientOne, 14, 10000, new DateTime(2003, 01, 01));
                LoanAccount loanTwo = new LoanAccount(clientTwo, 14, 10000, new DateTime(2003, 01, 01));
                MortgageAccount mortgageOne = new MortgageAccount(clientOne, 7, 100000, new DateTime(2013, 08, 01));
                MortgageAccount mortgageTwo = new MortgageAccount(clientTwo, 7, 100000, new DateTime(2014, 08, 01));
                Console.WriteLine("Deposit Account 1 Interest: {0:F2}", depositOne.Interest());
                Console.WriteLine("Deposit Account 2 Interest: {0:F2}", depositTwo.Interest());
                Console.WriteLine("Deposit Account 3 Interest: {0:F2}", depositThree.Interest());
                Console.WriteLine("Loan Account Individual Interest: {0:F2}", loanOne.Interest());
                Console.WriteLine("Loan Account Company Interest: {0:F2}", loanTwo.Interest());
                Console.WriteLine("Mortgage Account Interest: {0:F2}", mortgageOne.Interest());
                Console.WriteLine("Mortgage Account Interest: {0:F2}", mortgageTwo.Interest());
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
            }
        }