Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("**** Fun with Static Data ****");
            SavingAccount s1 = new SavingAccount(50);
            SavingAccount s2 = new SavingAccount(100);

            Console.WriteLine("Interest Rate is:{0}", SavingAccount.GetInterestRate());
            SavingAccount s3 = new SavingAccount(10000.75);

            Console.WriteLine("Interest Rate is:{0}", SavingAccount.GetInterestRate());
            Console.ReadLine();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            SavingAccount s1 = new SavingAccount(50);

            Console.WriteLine("Interest Rate is: {0}", SavingAccount.GetInterestRate());
            SavingAccount.SetInterestRate(0.08);
            SavingAccount s2 = new SavingAccount(100);

            Console.WriteLine("Interest Rate is: {0}", SavingAccount.GetInterestRate());
            SavingAccount s3 = new SavingAccount(10000.75);

            Console.WriteLine("Interest Rate is: {0}", SavingAccount.GetInterestRate());
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("**** Fun whth Static Data ****\n");
            SavingAccount s1 = new SavingAccount(50);
            SavingAccount s2 = new SavingAccount(100);

            //Вывести текущую процентную ставку.
            Console.WriteLine("Interest Rate is: {0}", SavingAccount.GetInterestRase());
            // Создать новый обьект; это не сбросит процентную ставку.
            SavingAccount s3 = new SavingAccount(10000.75);

            Console.WriteLine("Interest Rate is: {0}", SavingAccount.GetInterestRase());
            Console.ReadLine();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Console.WriteLine("***** Fun with Static Data *****\n");
            SavingAccount s1 = new SavingAccount(50);
            SavingAccount s2 = new SavingAccount(100);

            // Print the current interest rate.
            Console.WriteLine("Interest Rate is: {0}", SavingAccount.GetInterestRate());

            // Make new object, this does NOT 'reset' the interest rate.
            SavingAccount s3 = new SavingAccount(10000.75);

            Console.WriteLine("Interest Rate is: {0}",
                              SavingAccount.GetInterestRate());
            Console.ReadLine();
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            Console.WriteLine("**** Fun with Static Data ****\n");
            SavingAccount s1 = new SavingAccount(50);

            //Print the current interest rate.
            Console.WriteLine($"Interest Rate is: {SavingAccount.InterestRate}");

            //Try to change the interest rate via property
            SavingAccount.InterestRate = 0.08;

            //Make a second account
            SavingAccount s2 = new SavingAccount(100);

            //Should print 0.08...right??
            Console.WriteLine($"Interest Rate is: {SavingAccount.InterestRate}");
        }