Deposit() public method

public Deposit ( int deposit ) : void
deposit int
return void
Beispiel #1
0
 private static void Main()
 {
     var testAcc = new DepositAccount(Customer.Company, 10000000M, 0.5M);
     Console.WriteLine(testAcc);
     var secondTest = new LoanAccount(Customer.Individual, 10000M, 1M);
     Console.WriteLine(secondTest);
     Console.WriteLine(secondTest.CalcInterestAmount(6));
     secondTest.Deposit(503.56M);
     Console.WriteLine(secondTest);
 }
Beispiel #2
0
        static void Main()
        {
            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(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(account + " " + account.InterestAmount(8));
            }

            Console.WriteLine("\nInterest for next 20 mounts:");
            foreach (var account in accounts)
            {
                Console.WriteLine(account + " " + account.InterestAmount(20));
            }
        }
Beispiel #3
0
        private static void Main()
        {
            var testAcc = new DepositAccount(Customer.Company, 10000000M, 0.5M);

            Console.WriteLine(testAcc);
            var secondTest = new LoanAccount(Customer.Individual, 10000M, 1M);

            Console.WriteLine(secondTest);
            Console.WriteLine(secondTest.CalcInterestAmount(6));
            secondTest.Deposit(503.56M);
            Console.WriteLine(secondTest);
        }
Beispiel #4
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);
            }
        }
Beispiel #5
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);
            }
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            //新建一个个人存款账户
            DepositAccount A = new DepositAccount("WHM", 0);

            //存款
            A.Deposit(20000);
            //取款
            A.Withdraw(5000);
            //获得利息
            Console.WriteLine("您的利息为:{0}。", A.GetInterest(18, 0.035));
            //新建一个企业贷款账户
            LoanAccount B = new LoanAccount("WH", 1);

            //存款
            B.Deposit(20000);
            //获得利息
            Console.WriteLine("您的利息为:{0}。", B.GetInterest(27, 0.037));
            //抵押贷款同理,此处不给出
        }