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) { Message <string> g = new Message <string>(); g.Field1 = "Obligation:"; g.Field2 = "Your money:"; Tc Galery = new Tc("Galery"); Console.WriteLine("\n\nMAGAZINE:"); Galery.Magazine = new Shawerma(); Galery.Raschet(Galery.Magazine); Galery.Info(Galery.Magazine); Galery.Magazine = new Products(); Galery.Raschet(Galery.Magazine); Galery.Info(Galery.Magazine); Console.WriteLine("\n\nSTUFF:"); Galery.Stuff = new Toilet(); Galery.Raschet(Galery.Stuff); Galery.Info(Galery.Stuff); Galery.Comparer(Galery.CompareTo(Galery.Stuff)); Galery.Stuff = new Electro(); Galery.Raschet(Galery.Stuff); Galery.Info(Galery.Stuff); Galery.Comparer(Galery.CompareTo(Galery.Stuff)); Galery.Stuff = new Security(); Galery.Raschet(Galery.Stuff); Galery.Info(Galery.Stuff); if (Galery.AllMoney < 0) { Console.WriteLine(g.Field1 + Galery.AllMoney); } else { Console.WriteLine(g.Field2 + Galery.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); }