コード例 #1
0
ファイル: Program.cs プロジェクト: karinabutymova/OOP
        static void Main(string[] args)
        {
            PrintEdition PrintEdition1    = new PrintEdition("Книга");
            Book         Book             = new Book("Немного ненависти", "русский", 2019, 702);
            Author       AuthorOfBook     = new Author("Джо", "Аберкромби");
            Publishing   PublishingOfBook = new Publishing("FanZone");

            PrintEdition PrintEdition2       = new PrintEdition("Журнал");
            Magazin      Magazin             = new Magazin("Мурзилка", "русский", 2019, 193);
            Author       AuthorOfMagazin     = new Author("Виктория", "Абрамова");
            Publishing   PublishingOfMagazin = new Publishing("Детский мир");

            PrintEdition PrintEdition3        = new PrintEdition("Учебник");
            Textbook     Textbook             = new Textbook("EnglishInfo", "английский", 2020, 408);
            Author       AuthorOfTextbook     = new Author("Ellen", "Page");
            Publishing   PublishingOаTextbook = new Publishing("Express Publishin");

            Printer Printer = new Printer();

            Object[] mas = new Object[] { PrintEdition1, Book, AuthorOfBook, PublishingOfBook, PrintEdition2, Magazin, AuthorOfMagazin, PublishingOfMagazin, PrintEdition3, Textbook, AuthorOfTextbook, PublishingOаTextbook };

            for (int i = 0; i < mas.Length; i++)
            {
                Console.WriteLine(Printer.IAmPrinting(mas[i]));
                Console.WriteLine();
            }
            AuthorOfTextbook.Show();
            PublishingOаTextbook.Show();

            Console.WriteLine();
            Console.Write(AuthorOfBook.Name + " " + AuthorOfBook.Surname);
            if (AuthorOfBook is IShow1)
            {
                Console.WriteLine("-- очень известный автор");
            }
            else
            {
                Console.WriteLine("-- начинающий автор");
            }

            Console.WriteLine();
            PrintEdition1.Equals(Magazin);
            Console.ReadKey();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Console.Write("Типы изданий, присутствующие в библиотеке: ");
            foreach (var t in Type.GetNames(typeof(Type)))
            {
                Console.Write(t + ' ');
            }
            Console.WriteLine('\n');
            Console.WriteLine("_____________________________________________");

            Visitor visitor1 = new Visitor("Бутымова Карина", "учебник");

            visitor1.Info();
            Console.WriteLine("_____________________________________________");

            PrintEdition PrintEdition1    = new PrintEdition("Книга");
            Book         Book             = new Book("Немного ненависти", "русский", 2018, 702, 15.79);
            Author       AuthorOfBook     = new Author("Джо", "Аберкромби");
            Publishing   PublishingOfBook = new Publishing("FanZone");

            PrintEdition PrintEdition2       = new PrintEdition("Журнал");
            Magazin      Magazin             = new Magazin("Мурзилка", "русский", 2019, 193, 3.60);
            Author       AuthorOfMagazin     = new Author("Виктория", "Абрамова");
            Publishing   PublishingOfMagazin = new Publishing("Детский мир");

            PrintEdition PrintEdition3        = new PrintEdition("Учебник");
            Textbook     Textbook1            = new Textbook("EnglishInfo", "английский", 2020, 408, 25.87);
            Textbook     Textbook2            = new Textbook("Русский язык", "русский", 2010, 329, 5.60);
            Author       AuthorOfTextbook     = new Author("Ellen", "Page");
            Publishing   PublishingOаTextbook = new Publishing("Express Publishin");

            Library.Add(Book); Library.Add(Magazin); Library.Add(Textbook1); Library.Add(Textbook2);
            Library.Print();

            Console.WriteLine("_____________________________________________");
            Controller.YearOfPrinting();
            Console.WriteLine("_____________________________________________");
            Controller.CountOfTextbook();
            Console.WriteLine("_____________________________________________");
            Controller.PriceAll();
            Console.ReadKey();
        }