/**
 * Given a list of books and a specific category, append a new book to the list based on the category.
 *
 * @param books List of books already in the library.
 * @param category Category of the new book.
 * @return Updated list of books with the new book added based on the category.
 *
 * Example:
 * books = ["Python Programming", "Data Structures"]
 * addBooksToLibrary(books, "Programming") -> ['Python Programming', 'Data Structures', 'C++ Programming']
 *
 * books = ["Fiction", "Mystery"]
 * addBooksToLibrary(books, "Fantasy") -> ['Fiction', 'Mystery', 'Lord of the Rings']
 */
fun addBooksToLibrary(books: MutableList<String>, category: String): List<String> {

    // Prompt the librarian to enter the name of the new book
    print("Enter the name of the new book: ")
    val newBook = readLine() ?: ""

    // Check if the category is "Programming"
    if (category == "Programming") {
        // Append the new book to the list of books with category "Programming"
        books.add(newBook)
        // Print the updated list of books
        println(books)
    }
    
    // Add more else-if statements here for other categories...

    return books
}

// Usage
/**
 * Given a list of books and a specific category, append a new book to the list based on the category.
 *
 * @param books List of books already in the library.
 * @param category Category of the new book.
 * @return Updated list of books with the new book added based on the category.
 *
 * Example:
 * books = ["Python Programming", "Data Structures"]
 * addBooksToLibrary(books, "Programming") -> ['Python Programming', 'Data Structures', 'C++ Programming']
 *
 * books = ["Fiction", "Mystery"]
 * addBooksToLibrary(books, "Fantasy") -> ['Fiction', 'Mystery', 'Lord of the Rings']
 */
fun addBooksToLibrary(books: MutableList<String>, category: String): List<String> {
/**
 * Given a list of books and a specific category, append a new book to the list based on the category.
 *
 * @param books List of books already in the library.
 * @param category Category of the new book.
 * @return Updated list of books with the new book added based on the category.
 *
 * Example:
 * books = ["Python Programming", "Data Structures"]
 * addBooksToLibrary(books, "Programming") -> ['Python Programming', 'Data Structures', 'C++ Programming']
 *
 * books = ["Fiction", "Mystery"]
 * addBooksToLibrary(books, "Fantasy") -> ['Fiction', 'Mystery', 'Lord of the Rings']
 */
fun addBooksToLibrary(books: MutableList<String>, category: String): List<String> {

    // Prompt the librarian to enter the name of the new book
    print("Enter the name of the new book: ")
    val newBook = readLine() ?: ""

    // Check if the category is "Programming"
    if (category == "Programming") {
        // Append the new book to the list of books with category "Programming"
        books.add(newBook)
        // Print the updated list of books
        println(books)
    }
    
    // Add more else-if statements here for other categories...

    return books
}

// Usage