コード例 #1
0
        static public void PrintBookAll()
        {
            string type;
            string header;
            string img;
            string content;

            Console.WriteLine("What type of book?(magazine or book)");
            type = Console.ReadLine();
            if ((type.Equals("magazine") == true))
            {
                Console.WriteLine("Header: ");
                header = Console.ReadLine();
                Console.WriteLine("Images (yes or no: )");
                img = Console.ReadLine();
                Console.WriteLine("Content(mind idea): ");
                content = Console.ReadLine();
                PubBuilder magazineBuilder = new MagazineBuilder();
                Director   dir             = new Director();
                BookPub    magazineReport  = dir.GenerateReport(magazineBuilder, header, img, content);
                Console.WriteLine(magazineReport.Header);
                Console.WriteLine(magazineReport.Content);
                Console.WriteLine(magazineReport.Image);
                PrintBook();
            }
            else if ((type.Equals("book") == true))
            {
                Console.WriteLine("Header: ");
                header = Console.ReadLine();
                Console.WriteLine("Images (yes or no: )");
                img = Console.ReadLine();
                Console.WriteLine("Content(mind idea): ");
                content = Console.ReadLine();
                PubBuilder bookBuilder = new BookBuilder();
                Director   dir         = new Director();
                BookPub    bookReport  = dir.GenerateReport(bookBuilder, header, img, content);
                Console.WriteLine(bookReport.Header);
                Console.WriteLine(bookReport.Content);
                Console.WriteLine(bookReport.Image);
                PrintBook();
            }
            else
            {
                Console.WriteLine("Wrong command");
                PrintBookAll();
            }
        }
コード例 #2
0
        public void CreateReport()

        {
            report = new BookPub();
        }