static void Main(string[] args) { Book hello = new Book() { Title = "Hello", Author = "John", ISBN = "1234" }; Book goodbye = new Book(); goodbye.Title = "Goodbye"; goodbye.Author = "Paul"; goodbye.ISBN = "5678"; Book stop = new Book() { Title = "Stop", Author = "George", ISBN = "abcd" }; Book goGoGo = new Book(); goGoGo.Title = "GoGoGo"; goGoGo.Author = "Ringo"; goGoGo.ISBN = "efgh"; Book high = new Book(); high.Title = "High"; high.Author = "Rocky Raccoon"; high.ISBN = "ijkl"; Book low = new Book() { Title = "Low", Author = "Mean Mr. Mustard", ISBN = "mnop" }; List <Book> initialBooks = new List <Book>() { high, low }; Library helloGoodbye = new Library(initialBooks, "Vol 1", "Abbey Road"); helloGoodbye.AddToInventory(hello); helloGoodbye.AddToInventory(goodbye); helloGoodbye.AddToInventory(stop); helloGoodbye.AddToInventory(goGoGo); if (helloGoodbye.IsAvailable("mnop")) { Console.WriteLine($"{low.Title} is availabe"); } else { Console.WriteLine($"{low.Title} is not available"); } }
static void Main(string[] args) { Book endersGame = new Book() { Title = "Ender's Game", Author = "Orsen Scott", ISBN = "ABC123" }; Book harryPotter = new Book() { Title = "Harry Potter and the Chamber of Secrets", Author = "J.K. Rowling", ISBN = "123ABC" }; Book lotr = new Book() { Title = "Lord of the Rings", Author = "J R R Tolkien", ISBN = "QAZWSX1234" }; Book twilight = new Book() { Title = "Twilight", Author = "Stephen Meyers", ISBN = "1234XSWZAQ", IsAvailble = false }; Book book1 = new Book() { Title = "Book1", Author = "Author1", ISBN = "1A" }; Book book2 = new Book() { Title = "Book2", Author = "Author2", ISBN = "2B" }; List <Book> books = new List <Book> () { book1, book2 }; Library library = new Library(books, "Downtown Library", "123 Some St. Nashville, TN 12345"); library.AddToInventory(endersGame); library.AddToInventory(lotr); library.AddToInventory(harryPotter); library.AddToInventory(twilight); foreach (Book book in books) { if (book.IsAvailble) { Console.WriteLine($"{book.Title}"); } } }
static void Main(string[] args) { Console.WriteLine($"Hello World!"); Book endersGame = new Book() { Title = "Ender's Game", Author = "Orsen Scott", ISBN = "ABC123" }; Book tomSawyer = new Book(); tomSawyer.Title = "Tom Sawyer"; tomSawyer.Author = "Mark Twain"; tomSawyer.ISBN = "23234ASSDFSDA"; Book lotr = new Book() { Title = "Lord of the Rings", Author = "J R R Tolkien", ISBN = "ABC12312313123" }; Book twilight = new Book() { Title = "Twilight", Author = "Stephanie Meyers", ISBN = "c2SDFSDF123" }; Library library = new Library() { Name = "Downtown Library", Address = "Someplace Downtown" }; library.AddToInventory(endersGame); library.AddToInventory(tomSawyer); library.AddToInventory(twilight); library.AddToInventory(lotr); }
static void Main(string[] args) { // Create a few (4 or so) instances of books and use the method on your Library class to add them to the list of books in an instance of Library Book gameOfThrones = new Book() { Title = "Game of Thrones", Author = "George R.R. Martin", ISBN = "ABC123" }; Book lotr = new Book() { Title = "Lord of the Rings", Author = "George R R Martin", ISBN = "DEF456", IsAvailable = false }; Book twilight = new Book() { Title = "Twilight", Author = "Stephanie Meyers", ISBN = "GHI789" }; Book book1 = new Book() { Title = "Book1", Author = "Author1", ISBN = "1A" }; Book book2 = new Book() { Title = "Book2", Author = "Author2", ISBN = "2B" }; List <Book> books = new List <Book>() { book1, book2 }; Library library = new Library(books, "George R.R. Martin Memorial Library", "G.R.R. Martin Street"); library.AddToInventory(gameOfThrones); library.AddToInventory(lotr); library.AddToInventory(twilight); foreach (Book book in books) { if (book.IsAvailable) { Console.WriteLine($"{book.Title}"); } } if (library.IsAvailable("2B")) { Console.WriteLine("2B"); } else { Console.WriteLine("Not 2B"); } }
static void Main(string[] args) { Book endersGame = new Book() { Title = "Ender's Game", Author = "Orsen Scott", ISBN = "ABC123" }; Book tomSawyer = new Book(); tomSawyer.Title = "Tom Sawyer"; tomSawyer.Author = "Mark Twain"; tomSawyer.ISBN = "23234ASSDFSDA"; Book lotr = new Book() { Title = "Lord of the Rings", Author = "J R R Tolkien", ISBN = "ABC12323423" }; Book twilight = new Book() { Title = "Twilight", Author = "Stephanie Meyers", ISBN = "C2SDFSDF123" }; Book book1 = new Book() { Title = "Book1", Author = "Author1", ISBN = "1A" }; Book book2 = new Book() { Title = "Book2", Author = "Author2", ISBN = "2B", IsAvailable = false }; Console.WriteLine($"book2 isavaialble = {book2.IsAvailable}"); List <Book> books = new List <Book>() { book1, book2 }; Library library = new Library(books, "Downtown Library", "123 Some St. Nashville, TN 11111"); library.AddToInventory(endersGame); library.AddToInventory(lotr); library.AddToInventory(tomSawyer); library.AddToInventory(twilight); if (library.IsAvailable("2B")) { Console.WriteLine("2B is available"); } else { Console.WriteLine("2B is unavailable"); } /* * library.AddToInventory( * new Book() { * Title = "foo", Author = "bar", ISBN = "123" * }); */ }
static void Main(string[] args) { Book Diary = new Book() { Title = "The Diary Of a wimpy kid", Author = "Aryan", ISBN = "abcd" }; Book Point = new Book(); { Point.Title = "Five Point Someone"; Point.Author = "Chetan Bhagat"; Point.ISBN = "qwert"; }; Book CSharp = new Book(); { CSharp.Title = "C#"; CSharp.Author = "Priyanka"; CSharp.ISBN = "asdf"; }; Book React = new Book() { Title = "Learning React", Author = "Udemy", ISBN = "zxcv" }; Book book1 = new Book() { Title = "Book1", Author = "someone", ISBN = "hjnm" }; Book book2 = new Book() { Title = "Book2", Author = "someone", ISBN = "priyanka" }; List <Book> books = new List <Book>() { book1, book2 }; Library NSS = new Library(books, "Nashville software school", "500 interstate blvd"); NSS.AddToInventory(Diary); NSS.AddToInventory(Point); NSS.AddToInventory(CSharp); NSS.AddToInventory(React); if (NSS.IsAvailable("priyanka")) { Console.WriteLine($"{book2.Title} is avilable "); } else { Console.WriteLine($"{book2.Title} is not avilable"); } }
static void Main(string[] args) { Console.WriteLine("Hello World!"); // Create a few (4 or so) instances of books and use the method on your Library class to add them to the list of books in an instance of Library Book book1 = new Book(); book1.Title = "Harry Potter and the Prisoner of Azkaban"; book1.Author = "J.K. Rowling"; book1.ISBN = "9780439136358"; Book book2 = new Book(); book2.Title = "Harry Potter and the Goblet of Fire"; book2.Author = "J.K. Rowling"; book2.ISBN = "0439139597"; Book book3 = new Book(); book3.Title = "Harry Potter and the Order of the Phoenix"; book3.Author = "J.K. Rowling"; book3.ISBN = "9780439358064"; Book book4 = new Book(); book4.Title = "Harry Potter and the Half-Blood Prince"; book4.Author = "J.K. Rowling"; book4.ISBN = "0439784549"; Book book5 = new Book(); book5.Title = "Harry Potter and the Deathly Hallows"; book5.Author = "J.K. Rowling"; book5.ISBN = "043978454912234"; Book book6 = new Book(); book6.Title = "Harry Potter and the Chamber of Secrets"; book6.Author = "J.K. Rowling"; book6.ISBN = "0439784549907865832"; List <Book> books = new List <Book>() { book5, book6 }; Library potterBooks = new Library(books, "My Harry Potter Books", "My Home!"); potterBooks.AddToInventory(book1); potterBooks.AddToInventory(book2); potterBooks.AddToInventory(book3); potterBooks.AddToInventory(book4); // foreach (Book book in potterBooks){ // Console.WriteLine($"This book is {book.Title} by {book.Author}!") // } if (potterBooks.IsAvailable(book5.ISBN)) { Console.WriteLine($"{book5.Title} is available for checkout"); } else { Console.WriteLine($"{book5.Title} is not available"); } }
static void Main(string[] args) { Book lordOfTheRings = new Book() { Title = "Lord of the Rings", Author = "JRR Tolkien", ISBN = "LOTR1" }; Book theTwoTowers = new Book(); theTwoTowers.Title = "The Two Towers"; theTwoTowers.Author = "JRR Tolkien"; theTwoTowers.ISBN = "LOTR2"; Book returnOfTheKing = new Book() { Title = "Return of the King", Author = "JRR Tolkien", ISBN = "LOTR3" }; Book theSorcerersStone = new Book() { Title = "Harry Potter and the Sorcerer's Stone", Author = "Whats HerName", ISBN = "HP1" }; Book theChamberOfSecrets = new Book() { Title = "Harry Potter and the Chamber of Secrets", Author = "Whats HerName", ISBN = "HP2" }; Book book2 = new Book() { Title = "book2", Author = "Whats HerName", ISBN = "2B" }; List <Book> books = new List <Book>() { theChamberOfSecrets }; Library library = new Library(books, "NSS Library", "123 SomeWhere"); library.AddToInventory(lordOfTheRings); library.AddToInventory(theTwoTowers); library.AddToInventory(returnOfTheKing); library.AddToInventory(theSorcerersStone); if (library.IsAvailable("HP1")) { Console.WriteLine("is available"); } else { Console.WriteLine("is unavailable"); } }
static void Main(string[] args) { Book ChamberofSecrets = new Book() { Title = "Chamber of Secrets", Author = "jk rowling", ISBN = "123h456" }; Book AnotherBook = new Book() { Title = "Chamber of Secrets", Author = "jk rowling", ISBN = "123h456" }; Book Frankenstein = new Book() { Title = "Frankenstein", Author = "m shelley", ISBN = "098g098" }; Book ReadyPlayerOne = new Book() { Title = "Ready Player One", Author = "one", ISBN = "97g987" }; Book book1 = new Book() { Title = "Book1", Author = "Author1", ISBN = "1A" }; Book book2 = new Book() { Title = "Book2", Author = "Author2", ISBN = "2B", IsAvailable = false }; Console.WriteLine($"book2 isavaialble = {book2.IsAvailable}"); List <Book> books = new List <Book>() { book1, book2 }; Library library = new Library(books, "Downtown Library", "Main street"); library.AddToInventory(ChamberofSecrets); library.AddToInventory(AnotherBook); library.AddToInventory(Frankenstein); library.AddToInventory(ReadyPlayerOne); if (library.IsAvailable("2B")) { Console.WriteLine("2B is available"); } else { Console.WriteLine("2B is unavailable"); } }
static void Main(string[] args) { //Create Books Book book1 = new Book() { Title = "Game of Thrones", Author = "George R.R. Martin", ISBN = "111A" }; Book book2 = new Book() { Title = "Casino Royale", Author = "Ian Fleming", ISBN = "111B" }; Book book3 = new Book() { Title = "Lord of the Rings", Author = "J.R.R. Tolkien", ISBN = "111C" }; Book book4 = new Book() { Title = "Count of Monte Cristo", Author = "Alexander Dumas", ISBN = "111D" }; // Make two books for the initial inventory Book bookA = new Book() { Title = "BookA", Author = "AuthorA", ISBN = "A" }; Book bookB = new Book() { Title = "BookB", Author = "AuthorB", ISBN = "B" }; // make an initial inventory List <Book> initialInventory = new List <Book>(); initialInventory.Add(bookA); initialInventory.Add(bookB); // Create the library and give it the initial Inventory Library library1 = new Library(initialInventory) { Name = "Gulley's Library", Address = "here" }; // Add the books to the Library Inventory library1.AddToInventory(book1); library1.AddToInventory(book2); library1.AddToInventory(book3); library1.AddToInventory(book4); // create a Card Holder CardHolder tg = new CardHolder() { FullName = "Taylor Gulley", Id = 1234 }; //Check if a book is available if (library1.IsAvailable("111D")) { Console.WriteLine("This book is available"); } else { Console.WriteLine("This book is not available"); } // Checkout a book library1.Checkout("111D", tg); //Return the book library1.CheckIn("111D", tg); Console.WriteLine("Hello World!"); }