static void Main(string[] args) { Tc Galery = new Tc("Galery"); Console.WriteLine("\n\nMAGAZINE:"); Galery.Magazine = new Shawerma(); Galery.RaschetMagaz(); Galery.InfoMagaz(); Galery.Magazine = new Products(); Galery.RaschetMagaz(); Galery.InfoMagaz(); Console.WriteLine("\n\nSTUFF:"); Galery.Stuff = new Toilet(); Galery.RaschetStuff(); Galery.InfoStuff(); int compare = Galery.CompareTo(Galery.Stuff); switch (compare) { case 1: Console.WriteLine($"RASXOD:{Galery.Magazine.Name} > {Galery.Stuff.Name}"); break; case -1: Console.WriteLine($"RASXOD:{Galery.Magazine.Name} < {Galery.Stuff.Name}"); break; case 0: Console.WriteLine($"RASXOD:{Galery.Magazine.Name} = {Galery.Stuff.Name}"); break; default: Console.WriteLine("Technical problems"); break; } Galery.Stuff = new Electro(); Galery.RaschetStuff(); Galery.InfoStuff(); switch (compare) { case 1: Console.WriteLine($"RASXOD:{Galery.Magazine.Name} > {Galery.Stuff.Name}"); break; case -1: Console.WriteLine($"RASXOD:{Galery.Magazine.Name} < {Galery.Stuff.Name}"); break; case 0: Console.WriteLine($"RASXOD:{Galery.Magazine.Name} = {Galery.Stuff.Name}"); break; default: Console.WriteLine("Technical problems"); break; } Galery.Stuff = new Security(); Galery.RaschetStuff(); Galery.InfoStuff(); Console.WriteLine("\nAll viruchka: " + allMoney); }
static void Main(string[] args) { Messager handler = delegate(string message) { Console.WriteLine(message); }; Tc Galery = new Tc("Galery"); handler("\n\nMAGAZINE"); Galery.Magazine = new Shawerma(); Galery.RaschetMagaz(); Galery.InfoMagaz(); Galery.Magazine = new Products(); Galery.RaschetMagaz(); Galery.InfoMagaz(); handler("\n\nSTUFF:"); Galery.Stuff = new Toilet(); Galery.RaschetStuff(); Galery.InfoStuff(); int compare = Galery.CompareTo(Galery.Stuff); switch (compare) { case 1: handler($"RASXOD:{Galery.Magazine.Name} > {Galery.Stuff.Name}"); break; case -1: handler($"RASXOD:{Galery.Magazine.Name} < {Galery.Stuff.Name}"); break; case 0: handler($"RASXOD:{Galery.Magazine.Name} = {Galery.Stuff.Name}"); break; default: handler("Technical problems"); break; } Galery.Stuff = new Electro(); Galery.RaschetStuff(); Galery.InfoStuff(); switch (compare) { case 1: handler($"RASXOD:{Galery.Magazine.Name} > {Galery.Stuff.Name}"); break; case -1: handler($"RASXOD:{Galery.Magazine.Name} < {Galery.Stuff.Name}"); break; case 0: handler($"RASXOD:{Galery.Magazine.Name} = {Galery.Stuff.Name}"); break; default: handler("Technical problems"); break; } Galery.Stuff = new Security(); Galery.RaschetStuff(); Galery.InfoStuff(); handler("\nAll viruchka: " + allMoney); TcAdmin Admin = new TcAdmin(); int money; handler("Write how much you want money on account:"); try { Int32.TryParse(Console.ReadLine(), out money); if (money >= allMoney) { throw new Exception("You don't have enough money"); } Admin.Money(money); } catch (Exception excep) { Console.WriteLine(excep); throw; } handler("All money:" + allMoney); handler("Bank Account:" + Admin.Bank); }