예제 #1
0
 // Initialize the book database with some test books:
 static void AddBooks(BookDB bookDB)
 {
     bookDB.AddBook("The C Programming Language",
        "Brian W. Kernighan and Dennis M. Ritchie", 19.95m, true);
     bookDB.AddBook("The Unicode Standard 2.0",
        "The Unicode Consortium", 39.95m, true);
     bookDB.AddBook("The MS-DOS Encyclopedia",
        "Ray Duncan", 129.95m, false);
     bookDB.AddBook("Dogbert's Clues for the Clueless",
        "Scott Adams", 12.00m, true);
 }
예제 #2
0
 // Initialize the book database with some test books:
 static void AddBooks(BookDB bookDB)
 {
     bookDB.AddBook("The C Programming Language",
                    "Brian W. Kernighan and Dennis M. Ritchie", 19.95m, true);
     bookDB.AddBook("The Unicode Standard 2.0",
                    "The Unicode Consortium", 39.95m, true);
     bookDB.AddBook("The MS-DOS Encyclopedia",
                    "Ray Duncan", 129.95m, false);
     bookDB.AddBook("Dogbert's Clues for the Clueless",
                    "Scott Adams", 12.00m, true);
 }
예제 #3
0
        static void Main(string[] a)
        {
            BookDB bookDB = new BookDB();

            AddBooks(bookDB);

            Console.WriteLine("Paperback Book Titles: ");

            bookDB.ProcessPaperBackBooks(new ProcessBookDelegate(PrintTitle));

            priceTotaller priceTotaller = new priceTotaller();

            bookDB.ProcessPaperBackBooks(new ProcessBookDelegate(priceTotaller.AddBookToTotal));

            Console.WriteLine("Average Paperback Book Price: ${0:#.##}",
             priceTotaller.AveragePrice());
        }
예제 #4
0
        static void Main(string[] a)
        {
            BookDB bookDB = new BookDB();

            AddBooks(bookDB);

            Console.WriteLine("Paperback Book Titles: ");

            bookDB.ProcessPaperBackBooks(new ProcessBookDelegate(PrintTitle));

            priceTotaller priceTotaller = new priceTotaller();

            bookDB.ProcessPaperBackBooks(new ProcessBookDelegate(priceTotaller.AddBookToTotal));

            Console.WriteLine("Average Paperback Book Price: ${0:#.##}",
                              priceTotaller.AveragePrice());
        }
예제 #5
0
        static void Main(string[] args)
        {
            BookDB bookDB = new BookDB();

            AddBooks(bookDB);

            Console.WriteLine("Paperback Book Titles:");
            // Create a new delegate object associated with the static
            // method Test.PrintTitle:
            bookDB.ProcessPaperbackBooks(PrintTitle);

            // Get the average price of a paperback by using a PriceTotaller object:
            PriceTotaller totaller = new PriceTotaller();
            // Create a new delegate object associated with the nonstatic method AddBookToTotal on the object totaller:
            bookDB.ProcessPaperbackBooks(new ProcessBookDelegate(totaller.AddBookToTotal));

            Console.WriteLine("Average Paperback Book Price: ${0:#.##}", totaller.AveragePrice());
            Console.Read();
        }
예제 #6
0
        static void Main(string[] args)
        {
            BookDB bookDB = new BookDB();

            AddBooks(bookDB);

            Console.WriteLine("Paperback Book Titles:");
            // Create a new delegate object associated with the static
            // method Test.PrintTitle:
            bookDB.ProcessPaperbackBooks(PrintTitle);

            // Get the average price of a paperback by using a PriceTotaller object:
            PriceTotaller totaller = new PriceTotaller();

            // Create a new delegate object associated with the nonstatic method AddBookToTotal on the object totaller:
            bookDB.ProcessPaperbackBooks(new ProcessBookDelegate(totaller.AddBookToTotal));

            Console.WriteLine("Average Paperback Book Price: ${0:#.##}", totaller.AveragePrice());
            Console.Read();
        }