/********* Book return part *********/ public void BookReturn() { text.MyBurrowText7(); for (int i = 0; i < borrowedBooks.Count; i++) { text.MyBurrowText8(this, i); } string input2 = text.MyBurrowText3(); bool bConvert2 = Int32.TryParse(input2, out int bookToReturnIndex); if (bConvert2 && bookToReturnIndex - 1 < borrowedBooks.Count && bookToReturnIndex >= 0) { books.Add(borrowedBooks[bookToReturnIndex - 1]); borrowedBooks.RemoveAt(bookToReturnIndex - 1); for (int i = 0; i < borrowedBooks.Count; i++) { text.MyBurrowText8(this, i); } text.MyBurrowText9(); } else { text.MyBurrowText6(); switches.BookReturnSwitch(this); } }
static void Main(string[] args) { //convert classes to objects Library library = new Library(); LibSwitch libSwitch = new LibSwitch(); Console.WriteLine(library.Welcome()); Console.WriteLine(""); //overwiew of current books Console.WriteLine("Amount: " + library.books[0].Amount + " Title " + library.books[0].Title + " Pages " + library.books[0].Pages); Console.WriteLine("Amount: " + library.books[1].Amount + " Title " + library.books[1].Title + " Pages " + library.books[1].Pages); Console.WriteLine("Amount: " + library.books[2].Amount + " Title " + library.books[2].Title + " Pages " + library.books[2].Pages); //calls my object classes that contains my switch elements libSwitch.BookBurrowSwitch(library); libSwitch.BookReturnSwitch(library); }