Beispiel #1
0
        public static void Main()
        {
            Console.WriteLine("Deposit Account: ");

            var depositAcc = new DepositAccount(new Individual("Katya Ivanova", 213, new DateTime(1996, 5, 21), Gender.Female), 200000, 4);

            Console.WriteLine(depositAcc.ToString());
            depositAcc.AddMoney(20000);
            depositAcc.WithdrawMoney(213);

            Console.WriteLine("{0} Interest amount: {1}%", depositAcc.GetType().Name, depositAcc.InterestAmount(8)); // interest amount method

            Console.WriteLine(new string('-', 50));

            var companyDeposit = new DepositAccount(new Company("Apple", 12345, "Steve Jobs"), 52342343, 234);

            Console.WriteLine(companyDeposit.ToString());

            Console.WriteLine(new string('-', 50));

            Console.WriteLine("Loan Deposit: ");
            var loanDeposit = new LoanAccount(new Individual("Dimitur Topchev", 213, new DateTime(1992, 12, 14), Gender.Male), 2000, 2);

            Console.WriteLine(loanDeposit.ToString());
            Console.WriteLine("Interest amount {0}%", loanDeposit.InterestAmount(12));
            loanDeposit.AddMoney(23456);

            Console.WriteLine(new string('-', 50));

            Console.WriteLine("Mortgage Deposit");
            var mortgageAcc = new MortgageAccount(new Company("BFFS", 12383128, "Golemata Hazna"), 2500000, 0.1m);

            Console.WriteLine(mortgageAcc.ToString());
            Console.WriteLine("Interest amount {0}%", mortgageAcc.InterestAmount(12));
        }
        public static void Main()
        {
            Bank bank = new Bank("GoshoBank");

            bank.AddAccount(new MortgageAccount(new IndividualCustomer("Stamat"), 2000.0m, 18m));
            bank.AddAccount(new DepositAccount(new CompanyCustomer("Pesho Ltd.", "Pesho"), 7500.0m, 12m));
            bank.AddAccount(new LoanAccount(new CompanyCustomer("Alex Ltd.", "Alex"), 5000.0m, 12m));
            bank.AddAccount(new MortgageAccount(new IndividualCustomer("Osama"), 5000.0m, 18m));
            bank.AddAccount(new DepositAccount(new CompanyCustomer("Ivancho Ltd.", "Ivan"), 10000.0m, 12m));
            bank.AddAccount(new LoanAccount(new IndividualCustomer("Kiril"), 1500.0m, 24m));

            Console.WriteLine(bank.Name);
            Console.WriteLine(bank);

            IndividualCustomer customer = new IndividualCustomer("Pencho");

            DepositAccount depositAcc = new DepositAccount(customer, 7000.0m, 24);

            Console.WriteLine(depositAcc.ToString());

            depositAcc.Deposit(1500.0m);

            Console.WriteLine("Deposit account after deposit money: {0:C}", depositAcc.Balance);

            Console.WriteLine("Interes: {0:C}", depositAcc.CalculateInterest(24));

            depositAcc.WithdrawAmount(300);

            Console.WriteLine("Deposit account after withdraw: {0:C}", depositAcc.Balance);
        }
Beispiel #3
0
        static void Main()
        {
            //Deposit Test
            var depositAccIndividual = new DepositAccount(CustomerType.Individual, 2000.78m, 0.5m);

            Console.WriteLine("Customer: {0} | Balance: ${1:F2} | Interest Amount (12 Months): ${2:F2}",
                              depositAccIndividual.Customer, depositAccIndividual.Balance, depositAccIndividual.InterestAmount(12));

            depositAccIndividual.Withdraw(1500);
            Console.WriteLine("Balance after Withdraw: ${0:F2}", depositAccIndividual.Balance);
            Console.WriteLine();

            //Loan Test
            var loanAccCompany = new LoanAccount(CustomerType.Company, 3000000.1234m, 1.0m);

            Console.WriteLine("Customer: {0} | Balance: ${1:F2} | Interest Amount (1 Month): ${2:F2}",
                              loanAccCompany.Customer, loanAccCompany.Balance, loanAccCompany.InterestAmount(1));

            loanAccCompany.Deposit(1500000);
            Console.WriteLine("Balance after Deposit: ${0:F2}", loanAccCompany.Balance);
            Console.WriteLine("Interest Amount (13 Months): ${0:F2}", loanAccCompany.InterestAmount(13));
            Console.WriteLine();

            //Mortage Test
            var mortageAccCompany = new MortageAccount(CustomerType.Company, 17000000.98m, 1.5m);

            Console.WriteLine("Customer: {0} | Balance: ${1:F2} | Interest Amount (1 Month): ${2:F2}",
                              mortageAccCompany.Customer, mortageAccCompany.Balance, mortageAccCompany.InterestAmount(1));


            var mortageAccIndividual = new MortageAccount(CustomerType.Individual, 105000.13m, 1.0m);

            Console.WriteLine("Customer: {0} | Balance: ${1:F2} | Interest Amount (1 Month): ${2:F2}",
                              mortageAccIndividual.Customer, mortageAccIndividual.Balance, mortageAccIndividual.InterestAmount(1));
        }
Beispiel #4
0
        private static void ShowStart()
        {
            Customer customer2 = new Customer(CustomerType.Individuals, "Alex", "Vaslui", "074-5454 55");
            Customer customer3 = new Customer(CustomerType.Companies, "Bogdan", "Suceava", "075-67676 33");

            Account[] accounts = new Account[]
            {
                new DepositAccount(customer2, 700, 40),
                new DepositAccount(customer3, 700, 40),
                new DepositAccount(new Customer(CustomerType.Individuals, "Andrei"), 500, 30),
                new DepositAccount(new Customer(CustomerType.Companies, "SC fly SRL", "Brasov", "0787788745"), 4000, 50),
                new LoanAccount(customer2, 600, 40),
                new LoanAccount(customer3, 800, 50),
                new LoanAccount(new Customer(CustomerType.Individuals, "Alina"), 650, 25),
                new MortgageAccount(customer2, 1000, 20),
                new MortgageAccount(customer3, 1000, 20),
                new MortgageAccount(new Customer(CustomerType.Companies, "SC RealR SA"), 600, 3)
            };

            ShowBankStart banker = new ShowBankStart();

            banker.PrintMoney(accounts);
            DepositAccount depositsForCustomer2 = new DepositAccount(customer2, 5500, 35);
            DepositAccount depositsForCustomer3 = new DepositAccount(customer3, 3500, 45);

            depositsForCustomer2.WithDraw(700);
            depositsForCustomer2.Deposit(555);
            banker.PrintMoney(depositsForCustomer2);
            depositsForCustomer3.WithDraw(700);
            depositsForCustomer3.Deposit(555);
            banker.PrintMoney(depositsForCustomer3);
        }
Beispiel #5
0
        public static void Main()
        {
            Customer       ivan = new IndividualCustomer("Ivan");
            DepositAccount ivanDepositAccount = new DepositAccount(ivan, 500M, 4M);

            Console.WriteLine(ivanDepositAccount.Client.Name);
            Console.WriteLine(ivanDepositAccount.InterestRate);
            ivanDepositAccount.Deposit(100M);
            Console.WriteLine(ivanDepositAccount.Balance);
            ivanDepositAccount.Withdraw(100);
            Console.WriteLine(ivanDepositAccount.Balance);
            Console.WriteLine(ivanDepositAccount.CalculateInterest(5));
            Console.WriteLine(ivanDepositAccount);

            Customer        company = new CompanyCustomer("Company");
            MortgageAccount companyMortgageAcount = new MortgageAccount(company, 100000M, 1.5M);

            Console.WriteLine(companyMortgageAcount.Client.Name);
            Console.WriteLine(companyMortgageAcount);
            companyMortgageAcount.Deposit(10000);
            Console.WriteLine(companyMortgageAcount.Balance);
            companyMortgageAcount.CalculateInterest(20);

            LoanAccount companyLoanAccount = new LoanAccount(company, 25000M, 5M);

            Console.WriteLine(companyLoanAccount);
            companyLoanAccount.Deposit(5000.50M);
            Console.WriteLine(companyLoanAccount.CalculateInterest(30));
            Console.WriteLine(companyLoanAccount);
        }
        static void Main()
        {
            Customer individual = new Individual("Some Individual");
            Customer company = new Company("Some Company");
            Customer otherIndividual = new Individual("SomeOther Individual");
            Customer otherCompany = new Company("SomeOther Company");


            Account individualLoanAccount = new LoanAccount(individual, 2000, 2);
            decimal interest = individualLoanAccount.CalculateInterestAmount(5);

            Console.WriteLine(interest);

            Account companyMortgageAccount = new MortgageAccount(company, 20000, 3);
            interest = companyMortgageAccount.CalculateInterestAmount(5);

            Console.WriteLine(interest);

            Account depositIndividualAccount = new DepositAccount(individual, 900, 1.5M);
            depositIndividualAccount.Deposit(1000);
            interest = depositIndividualAccount.CalculateInterestAmount(2);
            Console.WriteLine(interest);


        }
Beispiel #7
0
        public static void TestDepositingAndWithdrawing()
        {
            // the test includes only deposit account whtihdrawing and depositing
            // because the output on the console would be too long
            // feel free to test the other components :)

            // creating an instance of an individual type customer
            var peshoCustomer = new IndividualCustomer("Pesho");

            // creating a deposit account and printing the information about the account
            var peshoDeposit = new DepositAccount(peshoCustomer, 25000, 2.5);

            Console.WriteLine(peshoDeposit);
            Console.WriteLine("============================");

            // depositing some money in the same account and printing it's information again
            peshoDeposit.DepositMoney(34.50m);
            Console.WriteLine(peshoDeposit);
            Console.WriteLine("=============================");

            // widthdrawing some money and then printing it's information again
            peshoDeposit.WithdrawMoney(120.68m);
            Console.WriteLine(peshoDeposit);
            Console.WriteLine("==============================");
        }
        static void Main()
        {
            Customer kircho = new Individual("a001", "Kiro", "8503122535", new DateTime(1990, 10, 25), Gender.Male);

            Customer firmata = new Company("a002", "p2p", "503122535");

            Console.WriteLine(firmata is Individual);
            Console.WriteLine(kircho is Individual);

            BankAccount mortgageAccTest  = new MortgageAccount(200.2m, 0.6m, kircho);
            BankAccount mortgageAccTest1 = new MortgageAccount(200.2m, 0.6m, firmata);

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

            BankAccount loanAccTest  = new LoanAccount(200.2m, 0.6m, kircho);
            BankAccount loanAccTest1 = new LoanAccount(200.2m, 0.6m, firmata);

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

            BankAccount depositAccTest  = new DepositAccount(3200.2m, 0.6m, kircho);
            BankAccount depositAccTest1 = new DepositAccount(1200.2m, 0.6m, firmata);

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

            depositAccTest.Deposit(200);
            Console.WriteLine(depositAccTest.Balance);
            var depositAcc = depositAccTest as DepositAccount;

            depositAcc.Withdraw(300);
            Console.WriteLine(depositAcc.Balance);
        }
Beispiel #9
0
        static void Main()
        {
            Customer kircho = new Individual("a001", "Kiro", "8503122535", new DateTime(1990, 10, 25));

            Customer firmata = new Company("a002", "p2p", "503122535");

            Console.WriteLine(firmata is Individual);
            Console.WriteLine(kircho is Individual);

            BankAccount mortgageAccTest = new MortgageAccount(200.2m, 0.6m, kircho);
            BankAccount mortgageAccTest1 = new MortgageAccount(200.2m, 0.6m, firmata);

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

            BankAccount loanAccTest = new LoanAccount(200.2m, 0.6m, kircho);
            BankAccount loanAccTest1 = new LoanAccount(200.2m, 0.6m, firmata);

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

            BankAccount depositAccTest = new DepositAccount(3200.2m, 0.6m, kircho);
            BankAccount depositAccTest1 = new DepositAccount(1200.2m, 0.6m, firmata);

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

            depositAccTest.Deposit(200);
            Console.WriteLine(depositAccTest.Balance);
            var depositAcc = depositAccTest as DepositAccount;
            depositAcc.Withdraw(300);
            Console.WriteLine(depositAcc.Balance);
        }
Beispiel #10
0
        public static void Main()
        {
            var testAcount = new DepositAccount(new Company("Abc", "040304123"), 3.47m);

            Console.WriteLine(testAcount);
            Console.WriteLine(testAcount.Deposit(1200m));
            Console.WriteLine(testAcount.Withdraw(101m));
            Console.WriteLine("Interest: " + testAcount.CalculateInterest(10));
            Console.WriteLine(testAcount);
            Console.WriteLine(new string('-', 60));
            var anotherTestAccount = new MortgageAccount(new Company("Apple", "040304123"), 5);

            Console.WriteLine(anotherTestAccount);
            Console.WriteLine(anotherTestAccount.Deposit(120m));
            Console.WriteLine("Interest:" + anotherTestAccount.CalculateInterest(13));
            Console.WriteLine(anotherTestAccount);
            Console.WriteLine(new string('-', 60));
            var yetAnotherTestAccount = new LoanAccount(new Individual("Gosho", "8010271234"), 4.2m);

            Console.WriteLine(yetAnotherTestAccount);
            Console.WriteLine(yetAnotherTestAccount.Deposit(180m));
            Console.WriteLine("Interest: " + yetAnotherTestAccount.CalculateInterest(3));
            Console.WriteLine(yetAnotherTestAccount);
            Console.WriteLine(new string('-', 60));
        }
Beispiel #11
0
        static void Main()
        {
            DepositAccount depos = new DepositAccount(Customer.company,125.66m,0.06m);
            Console.WriteLine(depos);
            depos.Deposite(1);
            Console.WriteLine(depos);
            depos.Draw(2);
            Console.WriteLine(depos);
            Console.WriteLine(depos.CalculateInerestRate(12));
            depos.Deposite(1000);
            Console.WriteLine(depos.CalculateInerestRate(12));

            LoanAccount loan = new LoanAccount(Customer.company, 12m, 0.055m);
            loan.Deposite(500);
            Console.WriteLine(loan.CalculateInerestRate(5));

            MortgageAccount mort = new MortgageAccount(Customer.individual, 100m, 0.05m);
            Console.WriteLine(mort.CalculateInerestRate(7));

            Account[] accounts = new Account[] { depos, loan, mort };
            foreach (var account in accounts)
            {
                Console.WriteLine(account);
            }
        }
Beispiel #12
0
        public static void Main()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            var deposit = new DepositAccount(customer: Customer.Company, balance: 200, interestRate: 20);

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

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

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

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

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

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

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

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

            // company
            var mortCompany = new MortgageAccount(customer: Customer.Company, balance: 20000, interestRate: 15);

            Console.WriteLine("Mortgage company account's Interest Amount: {0}", mortCompany.CalculateInterestAmount(months: 10));
            Console.WriteLine("Mortgage company account's Interest Amount: {0}\n", mortCompany.CalculateInterestAmount(months: 24));
        }
        public static void Run()
        {
            Account[] depositAccount = new Account[]
            {
                new DepositAccount(new Customer(CustomerType.Individuals, "Stamat Sedefov", "Pernik", "0899115011"), 150M, 5M),
                new DepositAccount(new Customer(CustomerType.Companies, "Telus", "Sofia", "*88"), 100000M, 18M),
                new DepositAccount(new Customer(CustomerType.Companies, "Apple", "California, USA", "555-123-123"), 50000M, 3M)
            };

            Account[] loanAccont = new Account[]
            {
                new LoanAccount(new Customer(CustomerType.Companies, "Vivacom", "Sofia", "02/55113"), 400M, 1M),
                new LoanAccount(new Customer(CustomerType.Individuals, "Gosho Peshov", "Veliko Tarnovo", "033-12-3"), 1M, 2M),
                new LoanAccount(new Customer(CustomerType.Individuals, "Mariika Toshova", "Burgas", "044-22-4"), 155M, 11M)
            };

            Account[] mortgageAccount = new Account[]
            {
                new MortgageAccount(new Customer(CustomerType.Individuals, "Blagoy Berbatov", "London", "024-44-44"), 1500M, 10M),
                new MortgageAccount(new Customer(CustomerType.Individuals, "Qlo Yolov", "Burgas", "08855123"), 444M, 2M),
                new MortgageAccount(new Customer(CustomerType.Companies, "Vivacom", "Sofia", "011-23-3"), 111M, 1M)
            };

            Console.WriteLine("---------- Deposit accounts ----------");
            PrintAccounts.Print(depositAccount);

            Console.WriteLine("---------- Loan accounts ----------");
            PrintAccounts.Print(loanAccont);

            Console.WriteLine("---------- Mortgage accounts ----------");
            PrintAccounts.Print(mortgageAccount);

            Console.WriteLine("---------- Mitko deposit accounts ----------");
            DepositAccount mitkoDepositeAccount = new DepositAccount(new Customer(CustomerType.Individuals, "Mitko Mitkov", "Pleven", "044-2222-2"), 500M, 12M);

            mitkoDepositeAccount.Deposit(111M);
            mitkoDepositeAccount.Withdraw(11M);
            Console.WriteLine("Mitko balance: " + mitkoDepositeAccount.Balance);
            Console.WriteLine();

            Console.WriteLine("---------- Asus loan accounts ----------");
            LoanAccount asusLoanAccount = new LoanAccount(new Customer(CustomerType.Companies, "ASUS", "Taiwan", "000111"), 199900M, 14M);

            asusLoanAccount.Deposit(1313M);
            Console.WriteLine("ASUS balande: " + asusLoanAccount.Balance);
            Console.WriteLine();

            Console.WriteLine("---------- Lenovo mortgage accounts ----------");
            MortgageAccount lenovoMortgageAccount = new MortgageAccount(new Customer(CustomerType.Companies, "LENOVO", "China", "0991100"), 33333M, 100M);

            lenovoMortgageAccount.Deposit(10000M);
            Console.WriteLine("Lenovo balance: " + lenovoMortgageAccount.Balance);
            Console.WriteLine();
        }
Beispiel #14
0
        public static void Main(string[] args)
        {
            Customer ivanIvanov     = new IndividualCustomer("Ivan Ivanov");
            Customer petarStoyanov  = new IndividualCustomer("Petar Stoyanov");
            Customer annaVasileva   = new IndividualCustomer("Anna Vasileva");
            Customer mariaAtanasova = new IndividualCustomer("Maria Atanasova ");
            Customer cocaCola       = new CompanyCustomer("CocaCola");
            Customer microsoft      = new CompanyCustomer("Microsoft");
            Customer apple          = new CompanyCustomer("Apple");
            Customer google         = new CompanyCustomer("Google");

            DepositAccount depositIvanIvanov    = new DepositAccount(ivanIvanov, 800m, 0.05m);
            DepositAccount depositCocaCola      = new DepositAccount(cocaCola, 5000000m, 0.02m);
            LoanAccount    loanAnnaVasilev      = new LoanAccount(annaVasileva, -10000m, 0.12m);
            LoanAccount    loanGoogle           = new LoanAccount(google, -1000000m, 0.08m);
            MortageAccount mortagePetarStoyanov = new MortageAccount(petarStoyanov, -50000m, 0.07m);
            MortageAccount mortageMictosoft     = new MortageAccount(microsoft, -5000000m, 0.06m);

            IList <Account> accounts = new List <Account>();

            accounts.Add(depositIvanIvanov);
            accounts.Add(depositCocaCola);
            accounts.Add(loanAnnaVasilev);
            accounts.Add(loanGoogle);
            accounts.Add(mortagePetarStoyanov);
            accounts.Add(mortageMictosoft);

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

            depositIvanIvanov.WithDraw(258.15m);
            Console.WriteLine("\nInterest for next 4 mounts:");
            foreach (var account in accounts)
            {
                Console.WriteLine("{0} {1,14:F2}", account, account.InterestAmount(4));
            }

            depositIvanIvanov.Deposit(800m);
            loanAnnaVasilev.Deposit(600.12m);
            mortagePetarStoyanov.Deposit(1825.12m);
            Console.WriteLine("\nInterest for next 8 mounts:");
            foreach (var account in accounts)
            {
                Console.WriteLine("{0} {1,14:F2}", account, account.InterestAmount(8));
            }

            Console.WriteLine("\nInterest for next 20 mounts:");
            foreach (var account in accounts)
            {
                Console.WriteLine("{0} {1,14:F2}", account, account.InterestAmount(20));
            }
        }
Beispiel #15
0
        static void Main(string[] args)
        {
            LoanAccount loan = new LoanAccount(Customer.Individual, 500, 2);

            Console.WriteLine(loan.CalculateInterest(12));
            loan.Deposit(1000);
            Console.WriteLine(loan.Balance);
            Account deposit = new DepositAccount(Customer.Company, 100000, 8);

            Console.WriteLine(deposit.CalculateInterest(3));
        }
        public static void Main()
        {
            var depositAcount = new DepositAccount(Customers.individual, 11500, 3);

            Console.WriteLine(depositAcount.Balance);

            depositAcount.DepositMoney(6000);
            Console.WriteLine(depositAcount.Balance);
            depositAcount.WithdrawMoney(4000);
            Console.WriteLine(depositAcount.Balance);
        }
 public static void Main()
 {
     IndividualCustomer pesho = new IndividualCustomer("Pesho");
     CompanyCustomer telerik = new CompanyCustomer("Telerik");
     LoanAccount loanAcc = new LoanAccount(pesho, 250, 25);
     DepositAccount depositAcc = new DepositAccount(telerik, 10000, 20);
     loanAcc.DepositAmount(100);
     Console.WriteLine(loanAcc.Balance);
     depositAcc.WithdrawAmount(5000);
     Console.WriteLine(depositAcc.Balance);
     Console.WriteLine(depositAcc.CalculateInterestAmount(12));
 }
Beispiel #18
0
        static void Main()
        {
            DepositAccount  depositAccount  = new DepositAccount(Customer.companies, 900.00, 6.8);
            LoanAccount     loanAccount     = new LoanAccount(Customer.companies, 5000.00, 7.1);
            MortgageAccount mortrageAccount = new MortgageAccount(Customer.individuals, 20000.00, 8.0);

            //Deposit accounts have no interest if their balance is positive and less than 1000.
            Console.WriteLine("Deposit account for 6 months(Balance: 900.00): {0:F2}", depositAccount.depositMoney(6));
            //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.
            Console.WriteLine("Loan account for 3 months for a company(Interest rate:7.1): {0:F2}", loanAccount.depositMoney(3));
            //Mortgage accounts have ½ interest for the first 12 months for companies and no interest for the first 6 months for individuals.
            Console.WriteLine("Mortrage account for 8 months for individual customer(Interest rate:8.0): {0:F2}", mortrageAccount.depositMoney(8));
        }
Beispiel #19
0
        static void Main()
        {
            List <Customer> customers = new List <Customer>
            {
                new IndividualCustomer("Pepo"),
                new IndividualCustomer("Tsura"),
                new IndividualCustomer("Vaso"),
                new CompanyCustomer("Software AG"),
                new CompanyCustomer("C3i"),
                new CompanyCustomer("Schneider Electric")
            };

            DepositAccount pepoDepAcc = new DepositAccount(customers[0], 300, 30);

            pepoDepAcc.DepositAmount(80);
            pepoDepAcc.WithdrawAmount(120);
            Console.WriteLine("Pepo's balance: {0}", pepoDepAcc.Balance);
            Console.WriteLine("Calculate Pepo's interest rate: {0}", pepoDepAcc.CalculateInterestRate(10));

            LoanAccount tsuraLoanAcc = new LoanAccount(customers[1], 800, 70);

            tsuraLoanAcc.DepositAmount(489);
            Console.WriteLine("Tsura's balance: {0}", tsuraLoanAcc.Balance);
            Console.WriteLine("Calculate Tsura's interest rate: {0}", tsuraLoanAcc.CalculateInterestRate(2));

            MortgageAccount vasoMortAcc = new MortgageAccount(customers[2], 500, 20);

            vasoMortAcc.DepositAmount(1000);
            Console.WriteLine("Vaso's balance: {0}", vasoMortAcc.Balance);
            Console.WriteLine("Calculate Vaso's interest rate: {0}", vasoMortAcc.CalculateInterestRate(12));

            DepositAccount softAgDepAcc = new DepositAccount(customers[3], 20000, 30);

            softAgDepAcc.DepositAmount(1000);
            softAgDepAcc.WithdrawAmount(20000);
            Console.WriteLine("Software AG's balance: {0}", softAgDepAcc.Balance);
            Console.WriteLine("Calculate Software AG's interest rate: {0}", softAgDepAcc.CalculateInterestRate(2));

            LoanAccount c3iLoanAcc = new LoanAccount(customers[4], 15000, 20);

            c3iLoanAcc.DepositAmount(700);
            Console.WriteLine("C3i's balance: {0}", c3iLoanAcc.Balance);
            Console.WriteLine("Calculate C3i's interest rate: {0}", c3iLoanAcc.CalculateInterestRate(10));

            MortgageAccount schneiderMortAcc = new MortgageAccount(customers[5], 90000, 50);

            schneiderMortAcc.DepositAmount(10000);
            Console.WriteLine("Schneider Electric's balance: {0}", schneiderMortAcc.Balance);
            Console.WriteLine("Calculate Schneider Electric's interest rate: {0}", schneiderMortAcc.CalculateInterestRate(20));
        }
Beispiel #20
0
        static void Main(string[] args)
        {
            LoanAccount     loan     = new LoanAccount(new Customer(TypeOfCustomer.IndividualClient, "Pesho Goshev", 123963), 12500, 1, 2);
            DepositAccount  deposit  = new DepositAccount(new Customer(TypeOfCustomer.CompanyClient, "Boc-Boc OOD", 789369), 5000000, 5, 3);
            MortgageAccount mortgage = new MortgageAccount(new Customer(TypeOfCustomer.IndividualClient, "Gosho Peshev", 159357), 147258, 4, 8);


            loan.Deposit(100);
            Console.WriteLine("The ballance of {0} is : {1}", loan.Customer.CustomerName, loan.Ballance);
            Console.WriteLine("The customer ID of {0} is : {1}", deposit.Customer.CustomerName, deposit.Customer.customerID);
            Console.WriteLine("The ballance of {0} is : {1}", deposit.Customer.CustomerName, deposit.Ballance);
            deposit.Deposit(100000);
            Console.WriteLine("The ballance of {0} after deposit is : {1}", deposit.Customer.CustomerName, deposit.Ballance);
            mortgage.InterestAmount(3);
        }
Beispiel #21
0
        static void Main()
        {
            // Deposit Account Tests
            Console.WriteLine("Deposit Account Test:");
            Console.WriteLine();

            var individualDeposit = new DepositAccount(new Individual("Joro Ivanov", 666, new DateTime(1995, 3, 8), GenderType.Male), 100000, 3);

            Console.WriteLine("Before depositing and withdrawing money");
            Console.WriteLine(individualDeposit);
            individualDeposit.DepositMoney(15600);
            individualDeposit.WithdrawMoney(854);
            Console.WriteLine("After depositing and withdrawing money");
            Console.WriteLine(individualDeposit);

            Console.WriteLine("{0} Interest amount: {1}%", individualDeposit.GetType().Name, individualDeposit.InterestAmount(8));

            Console.WriteLine(new string('-', 50));

            var companyDeposit = new DepositAccount(new Company("Batman Inc", 1, "Bruce Wayne"), 200006, 111);

            Console.WriteLine(companyDeposit);

            Console.WriteLine(new string('-', 50));

            // Loan Account Tests
            Console.WriteLine("Loan Account Test:");
            Console.WriteLine();

            var loanAccount = new LoanAccount(new Individual("Penka Draganova", 5, new DateTime(1990, 11, 21), GenderType.Female), 1000, 2);

            Console.WriteLine(loanAccount);
            Console.WriteLine("Interest amount {0}%", loanAccount.InterestAmount(12));
            loanAccount.DepositMoney(2000);     // Paying the loan

            Console.WriteLine(new string('-', 50));

            // Mortgage Account Tests
            Console.WriteLine("Mortgage Account Test:");
            Console.WriteLine();

            var mortgageAcc = new MortgageAccount(new Company("Ivo's Company", 19500, "Ivo"), 280000, 5.5m);

            Console.WriteLine(mortgageAcc);
            Console.WriteLine("Interest amount {0}%", mortgageAcc.InterestAmount(12));
        }
Beispiel #22
0
        static void Main(string[] args)
        {
            Bank bank = new Bank("FirstBank");

            Customer       P        = new Customer("Diana", CustomerType.Individuals);
            DepositAccount deposit1 = new DepositAccount(P, 15000, 3.45);

            bank.AddAccount(deposit1);

            Customer        Z      = new Customer("Gosho", CustomerType.Companies);
            MortgageAccount mortg1 = new MortgageAccount(Z, 50000, 5);

            bank.AddAccount(mortg1);

            Console.WriteLine(bank);

            for (int i = 0; i < bank.AllAccounts.Count; i++)
            {
                Console.WriteLine();
                Console.WriteLine("Account {0}: ", i + 1);
                Console.WriteLine(bank.AllAccounts[i]);
            }

            Console.WriteLine("---------- Mitko deposit accounts ----------");
            DepositAccount a = new DepositAccount(new Customer("Maria Daea", CustomerType.Individuals), 5000, 12);

            a.MakeDeposit(111000);
            a.Withdraw(5);
            Console.WriteLine("Totz balance: " + a.Balance);
            Console.WriteLine();

            Console.WriteLine("---------- AHA loan accounts ----------");
            LoanAccount asusLoanAccount = new LoanAccount(new Customer("Adria", CustomerType.Companies), 34567, 12);

            asusLoanAccount.MakeDeposit(10000);
            Console.WriteLine("AHA balance: " + asusLoanAccount.Balance);
            Console.WriteLine();

            Console.WriteLine("---------- B mortgage accounts ----------");
            MortgageAccount b = new MortgageAccount(new Customer("B", CustomerType.Companies), 345565, 50);

            b.MakeDeposit(1000);
            Console.WriteLine("B balance: " + b.Balance);
            Console.WriteLine();
        }
        static void Main()
        {
            var customer = new DepositAccount(Customer.Individual, 3000, 6.7);
            var anotherCustomer = new MortgageAccount(Customer.Company, 15.5M, 9.9);

            Console.WriteLine(customer.CalculateInterestRate(12));

            Console.WriteLine(customer.Balance);

            customer.Deposit(505.5M);
            Console.WriteLine(customer.Balance);

            var accounts = new Bank("UBB");
            accounts.AddAccount(customer);
            accounts.AddAccount(anotherCustomer);

            Console.WriteLine(accounts.ToString());
        }
        static void Main()
        {
            List<Customer> customers = new List<Customer>
            {
                new IndividualCustomer("Pepo"),
                new IndividualCustomer("Tsura"),
                new IndividualCustomer("Vaso"),
                new CompanyCustomer("Software AG"),
                new CompanyCustomer("C3i"),
                new CompanyCustomer("Schneider Electric")
            };

            DepositAccount pepoDepAcc = new DepositAccount(customers[0], 300, 30);
            pepoDepAcc.DepositAmount(80);
            pepoDepAcc.WithdrawAmount(120);
            Console.WriteLine("Pepo's balance: {0}", pepoDepAcc.Balance);
            Console.WriteLine("Calculate Pepo's interest rate: {0}", pepoDepAcc.CalculateInterestRate(10));

            LoanAccount tsuraLoanAcc = new LoanAccount(customers[1], 800, 70);
            tsuraLoanAcc.DepositAmount(489);
            Console.WriteLine("Tsura's balance: {0}", tsuraLoanAcc.Balance);
            Console.WriteLine("Calculate Tsura's interest rate: {0}", tsuraLoanAcc.CalculateInterestRate(2));

            MortgageAccount vasoMortAcc = new MortgageAccount(customers[2], 500, 20);
            vasoMortAcc.DepositAmount(1000);
            Console.WriteLine("Vaso's balance: {0}", vasoMortAcc.Balance);
            Console.WriteLine("Calculate Vaso's interest rate: {0}", vasoMortAcc.CalculateInterestRate(12));

            DepositAccount softAgDepAcc = new DepositAccount(customers[3], 20000, 30);
            softAgDepAcc.DepositAmount(1000);
            softAgDepAcc.WithdrawAmount(20000);
            Console.WriteLine("Software AG's balance: {0}", softAgDepAcc.Balance);
            Console.WriteLine("Calculate Software AG's interest rate: {0}", softAgDepAcc.CalculateInterestRate(2));

            LoanAccount c3iLoanAcc = new LoanAccount(customers[4], 15000, 20);
            c3iLoanAcc.DepositAmount(700);
            Console.WriteLine("C3i's balance: {0}", c3iLoanAcc.Balance);
            Console.WriteLine("Calculate C3i's interest rate: {0}", c3iLoanAcc.CalculateInterestRate(10));

            MortgageAccount schneiderMortAcc = new MortgageAccount(customers[5], 90000, 50);
            schneiderMortAcc.DepositAmount(10000);
            Console.WriteLine("Schneider Electric's balance: {0}", schneiderMortAcc.Balance);
            Console.WriteLine("Calculate Schneider Electric's interest rate: {0}", schneiderMortAcc.CalculateInterestRate(20));
        }
Beispiel #25
0
        static void Main(string[] args)
        {
            // Info for the Test
            // Declaring Companies and Individuals
            Company    TBI         = new Company("TBI", "Ivan");
            Company    puma        = new Company("Puma", "Konstantin Filipov");
            Company    addidas     = new Company("Addidas", "Martin Sonnerfeld");
            Individual me          = new Individual("Fancy", "Pants");
            Individual somePerson  = new Individual("Goldie", "Flint");
            Individual otherPerson = new Individual("Richie", "Golden");
            Individual thirdPerson = new Individual("Healthy", "Worths");

            // Making Accounts of the bank to calculate their Rate
            // Some of them have the same interest rate to see if the overriden methods return
            // different rates for the different types of accounts
            Account[] bankAccounts = new Account[7];
            bankAccounts[0] = new DepositAccount(TBI, 12000, 0.017);
            bankAccounts[1] = new LoanAccount(puma, 10000, 0.017);
            bankAccounts[2] = new MortageAccount(addidas, 11000, 0.017);
            bankAccounts[3] = new DepositAccount(me, 900, 0.037);
            bankAccounts[4] = new DepositAccount(somePerson, 1200, 0.047);
            bankAccounts[5] = new LoanAccount(otherPerson, 1000, 0.047);
            bankAccounts[6] = new MortageAccount(thirdPerson, 1100, 0.047);

            foreach (Account account in bankAccounts)
            {
                if (account.Customer is Individual)
                {
                    Console.WriteLine("The customer is an individual. ");
                    Console.WriteLine("His account is: Name: {0}, Balance: {1} leva"
                                      , account.Customer.Name, account.Balance.ToString());
                    Console.WriteLine("His interest Rate for two years: {0}", account.InterestAmount(24).ToString());
                    Console.WriteLine();
                }
                else
                {
                    Console.WriteLine("The customer is a company. ");
                    Console.WriteLine("Its account is: Name: {0}, Balance: {1} leva"
                                      , account.Customer.Name, account.Balance.ToString());
                    Console.WriteLine("Its interest Rate for two years: {0}", account.InterestAmount(24).ToString());
                    Console.WriteLine();
                }
            }
        }
Beispiel #26
0
        static void Main()
        {
            var customer        = new DepositAccount(Customer.Individual, 3000, 6.7);
            var anotherCustomer = new MortgageAccount(Customer.Company, 15.5M, 9.9);


            Console.WriteLine(customer.CalculateInterestRate(12));

            Console.WriteLine(customer.Balance);

            customer.Deposit(505.5M);
            Console.WriteLine(customer.Balance);

            var accounts = new Bank("UBB");

            accounts.AddAccount(customer);
            accounts.AddAccount(anotherCustomer);

            Console.WriteLine(accounts.ToString());
        }
Beispiel #27
0
        static void Main(string[] args)
        {
            var b = new Bank("BCR");

            var c1 = new Individual();

            var d = new DepositAccount(b, c1, 1000, 3.85m, 12);

            Console.WriteLine(d.CalculateInterest());


            var l = new LoanAccount(b, c1, 1000, 3.5m, 12);

            Console.WriteLine(l.CalculateInterest());

            var c2 = new Company();
            var m  = new MortgageAccount(b, c2, 1500, 3.8m, 36);

            Console.WriteLine(m.CalculateInterest());
        }
Beispiel #28
0
        static void Main(string[] args)
        {
            var deacc = new DepositAccount(234234.122m, 21313, Customers.Company);
            var loan  = new LoanAccount(234234.122m, 21313, Customers.Individual);
            var loan2 = new LoanAccount(234234.122m, 21313, Customers.Individual);
            var loan3 = new LoanAccount(234234.122m, 21313, Customers.Individual);

            deacc.WithdrawSum(234233.122m);
            Console.WriteLine(deacc.Balance);
            var bank = new Bank("Izgrev", "Pesho");

            bank.AddAccount(deacc);
            bank.AddAccount(loan);
            bank.AddAccount(loan2);
            bank.AddAccount(loan3);
            bank.RemoveAccount(loan);
            foreach (var item in bank.Accounts)
            {
                Console.WriteLine(item);
            }
        }
        static void Main()
        {
            IndividualCustomer inCustomerPesho = new IndividualCustomer("Pesho");
            CompanyCustomer comCustomerGoshoOOD = new CompanyCustomer("Gosho OOD");

            DepositAccount peshoDepositAcc = new DepositAccount(inCustomerPesho,500m);
            LoanAccount goshoLoanAcc = new LoanAccount(comCustomerGoshoOOD, 600m);
            MortgageAccount goshoMorAcc = new MortgageAccount(comCustomerGoshoOOD,550m);

            Console.WriteLine("\tPesho acc info");
            Console.WriteLine();

            Console.WriteLine("Balance in the begining: {0}",peshoDepositAcc.Balance);
            peshoDepositAcc.DepositAmount(6000m);
            Console.WriteLine("Balance after deposit: {0}",peshoDepositAcc.Balance);
            peshoDepositAcc.WithdrawAmount(100m);
            Console.WriteLine("Balance after withdraw: {0}",peshoDepositAcc.Balance);
            Console.WriteLine("Interest Amount: " + peshoDepositAcc.CalculateInterestAmount(50));

            Console.WriteLine();
            Console.WriteLine(new string('-',30));
            Console.WriteLine();
            Console.WriteLine("\t Gosho loan acc info");
            Console.WriteLine();

            Console.WriteLine("Balance in the begining: {0}",goshoLoanAcc.Balance);
            goshoLoanAcc.DepositAmount(50000m);
            Console.WriteLine("Balance after deposit: {0}",goshoLoanAcc.Balance);
            Console.WriteLine("Interest Amount: " + goshoLoanAcc.CalculateInterestAmount(25));
            Console.WriteLine();
            Console.WriteLine(new string('-', 30));
            Console.WriteLine();
            Console.WriteLine("\t Gosho Mortgage acc info");
            Console.WriteLine();

            Console.WriteLine("Balance in the begining: {0}",goshoMorAcc.Balance);
            goshoMorAcc.DepositAmount(50);
            Console.WriteLine("Balance after deposit: {0}",goshoMorAcc.Balance);
            Console.WriteLine("Interest Amount: " + goshoMorAcc.CalculateInterestAmount(5));
        }
Beispiel #30
0
        static void Main()
        {
            var individual = new Individual("Petar Petrov");
            var company    = new Company("Mobiltel EAD");

            var depositAccountInd  = new DepositAccount(3, 600, individual);
            var depositAccountComp = new DepositAccount(2, 6000, company);

            depositAccountInd.Deposit(50);
            depositAccountComp.Withdraw(1000);
            Console.WriteLine($"Individual balance in deposit account before interest: {depositAccountInd.Balance:F2}.");
            Console.WriteLine($"Company balance in deposit account before interest: {depositAccountComp.Balance:F2}.");

            var individualInterest = depositAccountInd.CalculateInterest(12);
            var companyInterest    = depositAccountComp.CalculateInterest(12);

            Divide();
            Console.WriteLine($"Individual balance after 12 months interest in deposit account: {individualInterest:F2}. (less than 1000 balance => no interest)");
            Console.WriteLine($"Company balance after 12 months interest in deposit account: {companyInterest:F2}.");
            var loanAcccountInd  = new LoanAccount(7, 650, individual);
            var loanAcccountComp = new LoanAccount(9, 5000, company);

            individualInterest = loanAcccountInd.CalculateInterest(12);
            companyInterest    = loanAcccountComp.CalculateInterest(12);
            Divide();
            Console.WriteLine($"Individual balance after 12 months interest in loan account: {individualInterest:F2}.");
            Console.WriteLine($"Company balance after 12 months interest in loan account: {companyInterest:F2}.");

            var mortageAccountInd  = new MortgageAccount(7, 650, individual);
            var mortageAccountComp = new MortgageAccount(9, 5000, company);

            individualInterest = mortageAccountInd.CalculateInterest(12);
            companyInterest    = mortageAccountComp.CalculateInterest(12);
            Divide();
            Console.WriteLine($"Individual balance after 12 months interest in mortage account: {individualInterest:F2}.");
            Console.WriteLine($"Company balance after 12 months interest in mortage account: {companyInterest:F2}.");
        }
Beispiel #31
0
        public static void Main()
        {
            // Some tests
            Console.WriteLine("Deposit Account: ");

            var depositAcc = new DepositAccount(new Individual("Tanya Skovska", 213, new DateTime(1994, 5, 26), Gender.Female), 200000, 4);

            Console.WriteLine(depositAcc.ToString());
            depositAcc.AddMoney(20000);
            depositAcc.WithdrawMoney(213);

            Console.WriteLine("{0} Interest amount: {1}%", depositAcc.GetType().Name, depositAcc.InterestAmount(8)); // interest amount method

            Console.WriteLine(new string('-', 50));

            var companyDeposit = new DepositAccount(new Company("Microsoft INC", 12345, "Bil Geits"), 44352423432, 234);

            Console.WriteLine(companyDeposit.ToString());

            Console.WriteLine(new string('-', 50));

            Console.WriteLine("Loan Deposit: ");
            var loanDeposit = new LoanAccount(new Individual("Pesho Peshov", 213, new DateTime(1990, 12, 16), Gender.Male), 2000, 2);

            Console.WriteLine(loanDeposit.ToString());
            Console.WriteLine("Interest amount {0}%", loanDeposit.InterestAmount(12));
            loanDeposit.AddMoney(23456);

            Console.WriteLine(new string('-', 50));

            Console.WriteLine("Mortgage Deposit");
            var mortgageAcc = new MortgageAccount(new Company("BFS", 12383128, "Golqmata Peruka"), 2500000, 0.1m);

            Console.WriteLine(mortgageAcc.ToString());
            Console.WriteLine("Interest amount {0}%", mortgageAcc.InterestAmount(12));
        }
        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);
        }