using System.Collections.Generic;
public static void Main()
Author stephen = new Author("Stephen King", 99);
Author tolkien = new Author("J.R. Tolkien", 199);
Author jkRowling = new Author("J.K. Rowling", 55);
Book a = new Book("The Stand", "0-545-01022-5", stephen);
Book b = new Book("Harry Potter", "1-745-01422-3", tolkien);
Book c = new Book("Lord of the Rings", "9-741-21872-9", jkRowling);
Customer timmy = new Customer("Timmy", 12);
Console.WriteLine(string.Format("Customer {0} borrowed:",timmy.Name));
foreach(Book book in timmy.Cart.Books)
Console.WriteLine(string.Format(" * Book {0} written by {1}.", book.Title, book.Writer.Name));
public string Name { get; set; }
public int Age { get; set; }
public Person(string name, int age)
public string Title { get; set; }
public string ISBN { get; set; }
public Author Writer { get; set; }
public Book(string title, string isbn, Author writer)
public class Author : Person
public List<Book> BooksWritten { get; set; }
public Author(string name, int age) : base(name, age)
BooksWritten = new List<Book>();
public void WriteBook(Book book)
public List<Book> Books { get; set; }
Books = new List<Book>();
public void AddBook(Book book)
public void RemveBook(Book book)
public class Customer : Person
public LibraryCart Cart { get; set; }
public Customer(string name, int age) : base(name, age)
Cart = new LibraryCart();
public void BorrowBook(Book book)