示例#1
0
        static void Main(string[] args)
        {
            var s1 = new SavingAccount(50);
            var s2 = new SavingAccount(100);

            Console.WriteLine($"Interest rate is {SavingAccount.GetInterestRate()}");

            var s3 = new SavingAccount(10000.75);

            Console.WriteLine($"Interest rate is {SavingAccount.GetInterestRate()}");
        }
        private void btnStaticDataandMembers_Click(object sender, RoutedEventArgs e)
        {
            TimeUtilClass.PrintDate();
            TimeUtilClass.PrintTime();

            var c1 = new SavingAccount(100);
            Console.WriteLine(@"Interest Rate is: {0}  / Balance is: {1}", SavingAccount.GetInterestRate(), c1.currBalance);

            var c2 = new SavingAccount(100.75);
            Console.WriteLine(@"Interest Rate is: {0}  / Balance is: {1}", SavingAccount.GetInterestRate(), c2.currBalance);
            var c3 = new SavingAccount(175.25);
            Console.WriteLine(@"Interest Rate is: {0}  / Balance is: {1}", SavingAccount.GetInterestRate(), c3.currBalance);
            SavingAccount.SetInterestRate(1.25);
            var c4 = new SavingAccount(775.75);
            Console.WriteLine(@"Interest Rate is: {0}  / Balance is: {1}", SavingAccount.GetInterestRate(), c4.currBalance);
            SavingAccount.InterestRat = 2.85;
            Console.WriteLine(@"Interest Rate is: {0}  / Balance is: {1}", SavingAccount.InterestRat, c4.currBalance);
        }