Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            BookDB bookDB = new BookDB();

            // Initialize the database with some books:
            AddBooks(bookDB);

            // Print all the titles of paperbacks:
            System.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(totaller.AddBookToTotal);

            System.Console.WriteLine("Average Paperback Book Price: ${0:#.##}",
                                     totaller.AveragePrice());
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            BookDB books = new BookDB();

            books.AddBook("Book1", "Vikas", 500, true);
            books.AddBook("Book2", "Vik", 450, true);
            books.AddBook("Book3", "Nik", 350, true);
            ProcessBookdel d = new ProcessBookdel(SellBook);

            d += RentBook;
            books.ProcessPaperbackBooks(d);
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            BookDB Newbook = new BookDB();

            Newbook.AddBook("Angular Essentials", "Dananjay Kumar Singh", 350, true);
            Newbook.AddBook("Java Fx", "DarkHill Publications", 200, true);

            ProcessPapaerBackDelegate de = new ProcessPapaerBackDelegate(SoldBook);

            de += RentBook;

            Newbook.ProcessPaperbackBooks(de);
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            BookDB books = new BookDB();

            books.AddBook("Book1", "Author1", 150, true);
            books.AddBook("Book2", "Author2", 250, true);
            books.AddBook("Book3", "Author3", 350, true);
            books.AddBook("Book4", "Author4", 450, true);
            ProcessBookCallbackDelegate d = new ProcessBookCallbackDelegate(SellBook);

            d += RentBook;
            books.ProcessPaperbackBooks(d);
        }