예제 #1
0
        // This function is hard codes books onto the system to speed up the testing process
        public static void addBooks(List <Book> books)
        {
            EJournal ej1 = new EJournal("7", "David", 8, 5.5, "ejournal.ie", 78);
            EJournal ej2 = new EJournal("8", "James", 6, 8.65, "ejournal.ie", 108);
            EJournal ej3 = new EJournal("9", "Andy", 5.95, 6.4, "ejournal.ie", 29);

            books.Add(ej1);
            books.Add(ej2);
            books.Add(ej3);

            Ebook eb1 = new Ebook("2", "John", 10, 3.5, "ebook.com", 4);
            Ebook eb2 = new Ebook("1", "Mary", 11, 3.5, "ebook.com", 5);
            Ebook eb3 = new Ebook("3", "Dylan", 12, 3.5, "ebook.com", 6);


            books.Add(eb1);
            books.Add(eb2);
            books.Add(eb3);


            PaperBook pb1 = new PaperBook("4", "Sarah", 5, 3.5, 8.9, 4.5);
            PaperBook pb2 = new PaperBook("5", "Mike", 8.99, 3.5, 6, 8.9);
            PaperBook pb3 = new PaperBook("6", "Sarah", 7.5, 3.5, 7, 6.5);


            books.Add(pb1);
            books.Add(pb2);
            books.Add(pb3);
        }
예제 #2
0
 //This function should display all the books that use the Idownloadable interface
 public static void displayIdownloadable(List <Book> books)
 {
     foreach (Book e in books)
     {
         if (e is Idownloadable)
         {
             Ebook ej = (Ebook)e;
             Console.WriteLine(ej.printURL());
         }
     }
 }