public static void Main(string[] args) { DateTime date = new DateTime(1995, 4, 27); Random random = new Random(); LibraryBook book = new LibraryBook( isbn: new LibraryBook.Isbn(), published: date, title: "My not so called Live", author: "Allan Walpy", content: " There was a boy. Just like any other. Except... He hated Christmas. \n So one day... he died... That's whole story, you know", quantity: 4); Console.WriteLine(book); while (book.IsAvailible) { if (random.Next(4) >= 1) { Console.WriteLine("taking"); book.Take(); } else { Console.WriteLine("returning"); book.Return(); } Console.WriteLine("Left {0} book(s)", book.Quantity); } Console.WriteLine(book); book.Read(); Console.WriteLine("------------------------"); ShopBook book2 = new ShopBook( isbn: new LibraryBook.Isbn(ean_ucc: 970, control_index: 9), published: DateTime.Today.AddDays(-5), title: "Alan Wake", author: "Steven Spilberg", price: 0.75, quantity: 3, content: " darkness followed his steps, until he falls" ); Console.WriteLine(book2); book2.Read(); Console.WriteLine("-----"); ((LibraryBook)book2).Read(); while (book2.IsAvailible) { book2.Buy(); Console.WriteLine("Left {0} books", book2.Quantity); } Console.WriteLine(book2); Console.ReadLine(); }
public ShopBook(ShopBook book) : this(book.ISBN, book.Published, book.Title, book.Author, book.Quantity, book.Content, book.Price) { }