public void OpenCumulativeAccount(decimal initAmount) { var account = "ACC" + AccountType.Cumulative.ToString() + (_openedAccountsCount + 1).ToString() + "000" + _number.ToString(); var newAccount = new CumulativeAccount(account, _name, initAmount); CumulativeAccounts.Add(newAccount); _openedAccountsCount++; }
static void Main(string[] args) { var client1 = new Client("Иванов Иван Иванович"); var client2 = new Client("Петров Петр Петрович "); var rnd = new Random(); client1.OpenSavingsAccount((decimal)rnd.Next(100, 3000)); client1.OpenCumulativeAccount((decimal)rnd.Next(10000, 15000)); client1.OpenCheckingAccount((decimal)rnd.Next(100, 5000)); client1.OpenMetalAccount(MetalType.Argentum, (uint)rnd.Next(100, 300), 1500.00M); client1.OpenMetalAccount(MetalType.Aurum, (uint)rnd.Next(100, 300), 4500.00M); client2.OpenSavingsAccount((decimal)rnd.Next(100, 3000)); client2.OpenCumulativeAccount((decimal)rnd.Next(10000, 15000)); client2.OpenCheckingAccount((decimal)rnd.Next(100, 5000)); client2.OpenMetalAccount(MetalType.Platinum, (uint)rnd.Next(100, 300), 6500.00M); client2.OpenMetalAccount(MetalType.Aurum, (uint)rnd.Next(100, 300), 4500.00M); client2.OpenMetalAccount(MetalType.Argentum, (uint)rnd.Next(100, 300), 1500.00M); Console.WriteLine("-----------Демонстрация работы с клиентами------------"); Console.WriteLine("Нажмите клавишу....."); Console.ReadKey(); Console.WriteLine(client1.ToString()); Console.WriteLine(); Console.WriteLine(client2.ToString()); Console.WriteLine(); switch (client1.CompareTo(client2)) { case 1: Console.WriteLine("Клиент {0} больше клиента {1}", client1.Name, client2.Name); break; case -1: Console.WriteLine("Клиент {0} меньше клиента {1}", client1.Name, client2.Name); break; case 0: Console.WriteLine("Клиент {0} равен клиенту {1}", client1.Name, client2.Name); break; } Console.WriteLine(); Console.WriteLine("-----------Демонстрация работы со счетами------------"); Console.WriteLine("Нажмите клавишу....."); Console.ReadKey(); Console.WriteLine(); Console.WriteLine("-----------Сберегательный счет------------"); var account1 = new SavingsAccount("11111111", "client1"); Console.WriteLine(account1.ToString()); account1.AddFunds(2000.00M); Console.WriteLine(account1.ToString()); account1.WithdrawFunds(500.50M); Console.WriteLine(account1.ToString()); account1.ZeroingAccount(); Console.WriteLine(account1.ToString()); account1.CloseAccount(); Console.WriteLine(account1.ToString()); account1.AddFunds(500); Console.WriteLine("Нажмите клавишу....."); Console.ReadKey(); Console.WriteLine(); Console.WriteLine("-----------Накопительный счет------------"); var account2 = new CumulativeAccount("22222222", "client2", 20000); Console.WriteLine(account2.ToString()); account2.AddFunds(1000.00M); Console.WriteLine(account2.ToString()); account2.WithdrawFunds(1000.00M); Console.WriteLine(account2.ToString()); account2.WithdrawFunds(1000.00M); Console.WriteLine(account2.ToString()); account2.InterestsCapitalization(); Console.WriteLine(account2.ToString()); account2.ZeroingAccount(); Console.WriteLine(account2.ToString()); account2.CloseAccount(); Console.WriteLine(account2.ToString()); Console.WriteLine("Нажмите клавишу....."); Console.ReadKey(); Console.WriteLine(); Console.WriteLine("-----------Расчетный счет------------"); var account3 = new CheckingAccount("33333333", "client3"); Console.WriteLine(account3.ToString()); account3.AddFunds(1000.00M); Console.WriteLine(account3.ToString()); account3.WithdrawFunds(500.00M); Console.WriteLine(account3.ToString()); account3.WithdrawFunds(500.00M); Console.WriteLine(account3.ToString()); account3.ZeroingAccount(); Console.WriteLine(account3.ToString()); account3.CloseAccount(); Console.WriteLine(account3.ToString()); Console.WriteLine("Нажмите клавишу....."); Console.ReadKey(); Console.WriteLine(); Console.WriteLine("-----------Металлический счет------------"); var account4 = new MetalAccount("444444444", "client4", MetalType.Aurum, 200, 1500.50M); Console.WriteLine(account4.ToString()); account4.AddFunds(500); Console.WriteLine(account4.ToString()); account4.WithdrawFunds(300); Console.WriteLine(account4.ToString()); account4.ZeroingAccount(); Console.WriteLine(account4.ToString()); account4.CloseAccount(); Console.WriteLine(account4.ToString()); }