示例#1
0
 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
 static void Main(string[] args)
 {
     BookDB bookDB = new BookDB();
     AddBooks(bookDB);
     Console.WriteLine("Paperback Book Tites:");
     bookDB.ProcessPaperbackBooks(new ProcessBookDelegate(PrintTitle));
     PriceTotaler totaller = new PriceTotaler();
     bookDB.ProcessPaperbackBooks(new ProcessBookDelegate(totaller.AddBookToTotal));
     Console.WriteLine("Average Paperback Book Price: ${0:#.##}", totaller.AveragePrice());
     Console.ReadKey();
 }
示例#3
0
 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);
 }
示例#4
0
        static void Main(string[] args)
        {
            BookDB bookDB = new BookDB();

            AddBooks(bookDB);
            Console.WriteLine("Paperback Book Tites:");
            bookDB.ProcessPaperbackBooks(new ProcessBookDelegate(PrintTitle));
            PriceTotaler totaller = new PriceTotaler();

            bookDB.ProcessPaperbackBooks(new ProcessBookDelegate(totaller.AddBookToTotal));
            Console.WriteLine("Average Paperback Book Price: ${0:#.##}", totaller.AveragePrice());
            Console.ReadKey();
        }