Exemple #1
0
        static int Main(string[] args)
        {
            Account acct1 = new Account();

            acct1.Id          = 1;
            acct1.Description = "Primary Account";
            acct1.Balance     = 0.0;
            acct1.Owner       = new Customer(100, "W Michael Robinson");
            Console.WriteLine(acct1.ToPrint());

            acct1.Deposit(-5.00);
            Console.WriteLine("The balance is " + acct1.GetBalance() + ".");

            acct1.Deposit(5.00);
            Console.WriteLine("The balance is " + acct1.GetBalance() + ".");

            acct1.Withdraw(5000.00);
            Console.WriteLine("The balance is " + acct1.GetBalance() + ".");

            Savings sav2 = new Savings();

            sav2.Id          = 2;
            sav2.Description = "Primary Savings Account";
            sav2.Balance     = 0.0;
            sav2.Owner       = new Customer(101, "Lisa Simpson");
            sav2.IntRate     = 0.12;

            sav2.Deposit(1000.00);
            Console.WriteLine(sav2.ToPrint());

            Checking chk1 = new Checking();

            chk1.Id          = 3;
            chk1.Description = "Primary Checking Account";
            chk1.Balance     = 0.0;
            chk1.Owner       = new Customer(102, "Homer Simpson");

            chk1.Deposit(2000.00);
            Console.WriteLine(chk1.ToPrint());

            Checking chka = new Checking();

            chka.Id          = 3;
            chka.Description = "Primary Checking Account";
            chka.Balance     = 0.0;
            chka.Owner       = new Customer(102, "Homer Simpson");

            chka.Deposit(2000.00);

            Checking chkb = new Checking();

            chkb.Id          = 3;
            chkb.Description = "Secondary Checking Account";
            chkb.Balance     = 0.0;
            chkb.Owner       = new Customer(102, "Homer Simpson");

            chkb.Deposit(2000.00);

            Savings sava = new Savings();

            sava.Id          = 2;
            sava.Description = "Primary Savings Account";
            sava.Balance     = 0.0;
            sava.Owner       = new Customer(102, "Homer Simpson");
            sava.IntRate     = 0.12;

            sava.Deposit(1000.00);

            Investment inv1 = new Investment();

            inv1.Deposit(500.00);
            Console.WriteLine(inv1.ToPrint());

            IAccountStatement[] accountsArray = { chka, chkb, sava, inv1 };

            double grandTotal = 0;

            foreach (IAccountStatement acct in accountsArray)
            {
                double acctBalance = acct.GetBalance();
                grandTotal = grandTotal + acctBalance;
                Console.WriteLine(acct.ToPrint());
            }

            Console.WriteLine("Grand Total is " + grandTotal);

            Console.ReadKey();
            return(0);
        }
Exemple #2
0
  { static void Main(string[] args)
    {
        Account acct1 = new Account();

        acct1.Id          = 1;
        acct1.Description = "My first checking account";
        acct1.Balance     = 0.0;
        acct1.Owner       = new Customer(100, "Greg Doud");

        acct1.Deposit(5.00);
        Console.WriteLine(acct1.ToPrint());

        acct1.Deposit(-5.00);
        Console.WriteLine("The balance is " + acct1.GetBalance() + " should be 0");

        acct1.Withdraw(-5.00);
        Console.WriteLine("The balance is " + acct1.GetBalance() + " should be 10.00");

        acct1.Withdraw(5000.00);
        Console.WriteLine("The balance is " + acct1.GetBalance() + " should be -4995.00");

        Savings sav2 = new Savings();

        sav2.Id          = 2;
        sav2.Description = "My first savings account";
        sav2.Balance     = 0.0;
        sav2.Owner       = new Customer(101, "Lisa S.");
        sav2.IntRate     = 0.12;
        sav2.Deposit(1000.00);

        Console.WriteLine(sav2.ToPrint());

        Checkings chk3 = new Checkings();

        chk3.Id          = 3;
        chk3.Description = "My first checking account";
        chk3.Balance     = 0.0;
        chk3.Owner       = new Customer(102, "Denise B.");

        chk3.Deposit(2000.00);

        Checkings chk4 = new Checkings();

        chk4.Id          = 4;
        chk4.Description = "My first checking account";
        chk4.Balance     = 0.0;
        chk4.Owner       = new Customer(102, "Kool B.");

        chk4.Deposit(2000.00);

        Savings chk5 = new Savings();

        chk5.Id          = 5;
        chk5.Description = "My first checking account";
        chk5.Balance     = 0.0;
        chk5.Owner       = new Customer(102, "Rich B.");
        chk5.IntRate     = 0.12;

        chk5.Deposit(2000.00);

        Investment inv1 = new Investment();

        inv1.Deposit(500.00);

        IAccountStatement[] accounts = { chk4, chk5, chk3, inv1 };

        double grandTotal = 0;


        foreach (Account acct in accounts)
        {
            double accBalance = acct.GetBalance();
            grandTotal = grandTotal + acct.Balance;
            Console.WriteLine(acct.ToPrint());
        }
        Console.WriteLine("Grand total is " + grandTotal.ToString());
        Console.ReadKey();

        Account acct000 = new Savings();
    }
Exemple #3
0
        static void Main(string[] args)
        {
            // Account acct1 = new Account();
            // Account acct2 = new Account();
            // Savings savingsAcct = new Savings();
            // savingsAcct.InterestRate = .015m;

            // Customer customer = new Customer(1, "Mike");
            // Customer customer2 = new Customer(2, "Hank");

            // savingsAcct.Owner = customer;
            // savingsAcct.Description = "Mikes Savings Account";
            // savingsAcct.Id = 3;

            // acct1.Owner = customer;
            // acct1.Description = "Mikes checking account";
            // acct1.Id = 1;

            // acct2.Owner = customer2;
            // acct2.Description = "Hanks checking";
            // acct2.Id = 2;



            // acct1.Deposit(200.10m);
            // acct1.WithDraw(1000.35m);
            // acct1.WithDraw(-10000.00m);
            // acct1.WithDraw(100.24m);
            // acct1.Deposit(502.51m);
            // acct1.WithDraw(300.21m);
            // acct1.Deposit(50.00m);

            //// acct1.ShowHistory();

            // Account.Transfer(acct1, acct2, 2.22m);

            // acct1.ShowHistory();
            // acct2.ShowHistory();

            // savingsAcct.Deposit(15000.00m);
            // savingsAcct.ApplyInterest(6);
            // savingsAcct.ShowHistory();

            // WriteLine(acct1.ToPrint());
            // WriteLine(acct2.ToPrint());
            // WriteLine(savingsAcct.ToPrint());

            //Checking mychecking = new Checking();
            //mychecking.Description = "Mike Bob's Checking Account 1";
            //Customer c = new Customer(10, "Mike Bob");
            //mychecking.Owner = c;
            //mychecking.Deposit(1000.00m);

            //Checking mychecking2 = new Checking();
            //mychecking2.Description = "Mike Bob's Checking Account 2";
            //mychecking2.Owner = c;
            //mychecking2.Deposit(500.00m);

            //Savings mysaving = new Savings();
            //mysaving.Description = "Mike Bob's Savings Account 1";
            //mysaving.Owner = c;
            //mysaving.Deposit(1500.00m);

            //Account[] accounts = { mychecking, mychecking2, mysaving };


            //for(int i = 0; i < 50; i++)
            //{
            //    mysaving.Deposit((decimal)i * 50);
            //}
            //foreach (var i in accounts)
            //{

            //   // WriteLine(i.ToPrint());
            //}

            //// mychecking.WithDraw(500.00m, 5);
            ////WriteLine(mychecking.ToPrint());
            //mysaving.ShowHistory();


            Account account = new Account();

            account.Description = "Its an investment not account";
            Investment i = new Investment(account);

            i.Deposit(500.00m);
            i.ShowHistory();
        }
Exemple #4
0
        static int Main(string[] args)
        {
            //Account acct1 = new Account();
            //acct1.Id = 1;
            //acct1.Description = "My first checking account";
            //acct1.Balance = 0.0;
            //acct1.Owner = new Customer(100, "Greg Doud");
            //Console.WriteLine(acct1.ToPrint());

            //acct1.Deposit(5.00);
            //Console.WriteLine(acct1.ToPrint());

            //acct1.Deposit(-5.00);
            //Console.WriteLine(acct1.ToPrint());

            //acct1.Withdraw(5000.00);
            //Console.WriteLine(acct1.ToPrint());

            //Savings sav2 = new Savings();
            //sav2.Id = 2;
            //sav2.Description = "My first savings account";
            //sav2.Balance = 0.0;
            //sav2.Owner = new Customer(101, "Lisa S.");
            //sav2.IntRate = 0.12;

            //sav2.Deposit(1000.00);
            //Console.WriteLine(sav2.ToPrint());

            //Checking chk3 = new Checking();
            //chk3.Id = 3;
            //chk3.Description = "My first checking account";
            //chk3.Balance = 0.0;
            //chk3.Owner = new Customer(102, "Denise B.");

            //chk3.Deposit(2000.00);
            //Console.WriteLine(chk3.ToPrint());

            //// print out monthly statement

            Checking chka = new Checking();

            chka.Id          = 3;
            chka.Description = "My first checking account";
            chka.Balance     = 0.0;
            chka.Owner       = new Customer(103, "Kim P.");

            chka.Deposit(2000.00);

            Checking chkb = new Checking();

            chkb.Id          = 3;
            chkb.Description = "My second checking account";
            chkb.Balance     = 0.0;
            chkb.Owner       = new Customer(103, "Kim P.");

            chkb.Deposit(2000.00);

            Savings sava = new Savings();

            sava.Id          = 2;
            sava.Description = "My first savings account";
            sava.Balance     = 0.0;
            sava.Owner       = new Customer(103, "Kim P.");
            sava.IntRate     = 0.12;

            sava.Deposit(1000.00);

            Investment inv1 = new Investment();

            inv1.Deposit(500.00);

            IAccountStatement[] accounts = { chka, chkb, sava, inv1 };

            double grandTotal = 0;

            foreach (IAccountStatement acct in accounts)
            {
                double acctBalance = acct.GetBalance();
                grandTotal = grandTotal + acctBalance;
                Console.WriteLine(acct.ToPrint());
            }
            Console.WriteLine("Grand total is " + grandTotal.ToString());


            Savings s = new Savings();

            Account s1 = new Savings();

            Account c = new Checking();



            Console.ReadKey();
            return(0);
        }