Exemple #1
0
        public static void Main()
        {
            try

            {
                string author = Console.ReadLine();

                string title = Console.ReadLine();

                decimal price = decimal.Parse(Console.ReadLine());

                Book book = new Book(author, title, price);

                GoldenEditionBook goldenEditionBook = new GoldenEditionBook(author, title, price);

                Console.WriteLine(book);

                Console.WriteLine(goldenEditionBook);
            }

            catch (ArgumentException ae)

            {
                Console.WriteLine(ae.Message);
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("**********Inheritance!**********");
            Console.WriteLine("Problem 2. Book Shop");

            try {
                string            author            = Console.ReadLine();
                string            title             = Console.ReadLine();
                decimal           price             = decimal.Parse(Console.ReadLine());
                Book              book              = new Book(author, title, price);
                GoldenEditionBook goldenEditionBook = new GoldenEditionBook(author, title, price);
                Console.WriteLine(book + Environment.NewLine);
                Console.WriteLine(goldenEditionBook);
            }
            catch (ArgumentException ae)
            {
                Console.WriteLine(ae.Message);
            }

            Console.ReadKey();
        }