static void Main(string[] args)
        {
            Library library = new Library();
            StudentFantast stFantast = new StudentFantast();
            StudentComputerScientist stCompScientist = new StudentComputerScientist();

            library.registerStudent(stFantast);
            library.registerStudent(stCompScientist);

            library.AddBook(new Book("The Lord of the rings", "Peter Jackson", "fantasy"));
            library.AddBook(new Book("Modern operating systems", "Andrew Tanenbaum", "computer science"));
            library.AddBook(new Book("Triumphal arch", "Erich Maria Remarque", "war novel"));

            Book book1 = new Book("The computer science", "The author", "computer science");
            library.AddBook(book1);

            try
            {
                library.TakeBook(book1);
            }
            catch (ArgumentException)
            {

            }

            foreach (Book book in library)
            {
                Console.WriteLine(book.BookName);
            }

            Console.ReadKey();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Library library = new Library();
            StudentFantast stFantast = new StudentFantast();
            StudentComputerScientist stCompScientist = new StudentComputerScientist();

            library.registerStudent(stFantast);
            library.registerStudent(stCompScientist);

            library.AddBook(new Book("The Lord of the rings", "Peter Jackson", "fantasy"));
            library.AddBook(new Book("Modern operating systems", "Andrew Tanenbaum", "computer science"));
            library.AddBook(new Book("Triumphal arch", "Erich Maria Remarque", "war novel"));

            Console.ReadKey();
        }
Exemplo n.º 3
0
        public Student(string name, Genre prefGenre, Library lib)
        {
            if (name == null || lib == null)
            {
                throw new ArgumentNullException();
            }
            else
            {
                _name = name;
                _preferedGenre = prefGenre;

                lib.BookAdded += NewBook;
                lib.BookRemoved += BookWasRemoved;
            }
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            var lib = new Library();

            Student studentf = new Student("Vasya", Genre.Fantastic, lib);
            Student studentc = new Student("Petya", Genre.Computer, lib);

            lib.AddBook(new Book("CLR via C#", "Jeffrey Richter", Genre.Computer));
            lib.AddBook(new Book("C# in a nutshell", "Joseph Albahari", Genre.Computer));
            lib.AddBook(new Book("Win10", "Andy Rathbone", Genre.Computer));
            lib.AddBook(new Book("The Time Machine", "H. G. Wells", Genre.Fantastic));
            lib.AddBook(new Book("The Lord of the Rings", "J. R. R. Tolkien", Genre.Fantastic));

            lib.GetBook("C# in a nutshell");

            Console.ReadKey();
        }