/********* Book burrow part *********/ public void BookBurrow() { text.MyBurrowText1(); for (int i = 0; i < books.Count; i++) // For each element in the list print from method MyBurrowText2 { text.MyBurrowText2(this, i); } string input = text.MyBurrowText3(); bool bConvert = Int32.TryParse(input, out int bookToBorrowIndex); //converts input string to a Int32 if (bConvert && bookToBorrowIndex - 1 < books.Count && bookToBorrowIndex >= 0) { borrowedBooks.Add(books[bookToBorrowIndex - 1]); books.RemoveAt(bookToBorrowIndex - 1); text.MyBurrowText4(); for (int i = 0; i < books.Count; i++) { text.MyBurrowText2(this, i); // calls data from this library } text.MyBurrowText5(this); } else { text.MyBurrowText6(); switches.BookBurrowSwitch(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); }