Create a Java program that simulates a simple library book tracking system. The library has a fixed number of books, and the program should allow the librarian to view, update, and search the books. The program must utilize one-dimensional arrays to manage the information. Most of the requirements have been fulfilled. Starter code is given. Fill in what is missing

Given Code:
import java.util.Scanner;
public class LibraryBookTracker {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String[] bookCatalog = {
"Moby Dick", "The Great Gatsby", "To Kill a Mockingbird",
"Pride and Prejudice", "1984", "Brave New World",
"The Catcher in the Rye", "Lord of the Rings", "Harry Potter and
the Sorcerer's Stone",
"Animal Farm"
};
int capacity = bookCatalog.length;
while (true) {
System.out.println("Welcome to Library Book Tracker!");
System.out.println("1. View Catalog");
System.out.println("2. Search Book");
System.out.println("3. Add Book");
System.out.println("4. Remove Book");
System.out.println("5. Exit");
System.out.print("Select an option: ");
int choice = scanner.nextInt();
scanner.nextLine(); // Consume the newline character
switch (choice) {
case 1:
viewCatalog(bookCatalog);
break;
case 2:
searchBook(scanner, bookCatalog);
break;
case 3:
addBook(scanner, bookCatalog, capacity);
break;
case 4:
removeBook(scanner, bookCatalog);
break;
case 5:
System.out.println("Goodbye!");
scanner.close();
return;
default:
System.out.println("Invalid option. Please select a valid
option.");
}
}
}
public static void viewCatalog(String[] bookCatalog) {
//Your code goes here
}
public static void searchBook(Scanner scanner, String[] bookCatalog) {
//Your code goes here
}
public static void addBook(Scanner scanner, String[] bookCatalog, int capacity)
{
//Your code goes here
}
public static void removeBook(Scanner scanner, String[] bookCatalog) {
System.out.print("Enter the title of the book to remove: ");
String titleToRemove = scanner.nextLine();
int position = findBookPosition(titleToRemove, bookCatalog);
if (position != -1) {
bookCatalog[position] = null;
System.out.println("Book \"" + titleToRemove + "\" removed from the
catalog.");
} else {
System.out.println("Book not found.");
}
}
public static int findBookPosition(String title, String[] bookCatalog) {
for (int i = 0; i < bookCatalog.length; i++) {
if (bookCatalog[i] != null && bookCatalog[i].equalsIgnoreCase(title)) {
return i;
}
}
return -1;
}
}

import java.util.Scanner;

public class LibraryBookTracker {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String[] bookCatalog = {
"Moby Dick", "The Great Gatsby", "To Kill a Mockingbird",
"Pride and Prejudice", "1984", "Brave New World",
"The Catcher in the Rye", "Lord of the Rings", "Harry Potter and the Sorcerer's Stone",
"Animal Farm"
};
int capacity = bookCatalog.length;

while (true) {
System.out.println("Welcome to Library Book Tracker!");
System.out.println("1. View Catalog");
System.out.println("2. Search Book");
System.out.println("3. Add Book");
System.out.println("4. Remove Book");
System.out.println("5. Exit");
System.out.print("Select an option: ");
int choice = scanner.nextInt();
scanner.nextLine(); // Consume the newline character

switch (choice) {
case 1:
viewCatalog(bookCatalog);
break;
case 2:
searchBook(scanner, bookCatalog);
break;
case 3:
addBook(scanner, bookCatalog, capacity);
break;
case 4:
removeBook(scanner, bookCatalog);
break;
case 5:
System.out.println("Goodbye!");
scanner.close();
return;
default:
System.out.println("Invalid option. Please select a valid option.");
}
}
}

public static void viewCatalog(String[] bookCatalog) {
System.out.println("Catalog:");
for (int i = 0; i < bookCatalog.length; i++) {
if (bookCatalog[i] != null) {
System.out.println((i+1) + ". " + bookCatalog[i]);
}
}
}

public static void searchBook(Scanner scanner, String[] bookCatalog) {
System.out.print("Enter the title of the book to search: ");
String titleToSearch = scanner.nextLine();
int position = findBookPosition(titleToSearch, bookCatalog);
if (position != -1) {
System.out.println("Book found at position " + (position+1));
} else {
System.out.println("Book not found.");
}
}

public static void addBook(Scanner scanner, String[] bookCatalog, int capacity) {
if (isCatalogFull(bookCatalog)) {
System.out.println("Catalog is full. Cannot add more books.");
return;
}
System.out.print("Enter the title of the book to add: ");
String titleToAdd = scanner.nextLine();
int position = findEmptyPosition(bookCatalog);
bookCatalog[position] = titleToAdd;
System.out.println("Book \"" + titleToAdd + "\" added to the catalog at position " + (position+1));
}

public static boolean isCatalogFull(String[] bookCatalog) {
for (String title : bookCatalog) {
if (title == null) {
return false;
}
}
return true;
}

public static int findEmptyPosition(String[] bookCatalog) {
for (int i = 0; i < bookCatalog.length; i++) {
if (bookCatalog[i] == null) {
return i;
}
}
return -1;
}

public static void removeBook(Scanner scanner, String[] bookCatalog) {
System.out.print("Enter the title of the book to remove: ");
String titleToRemove = scanner.nextLine();
int position = findBookPosition(titleToRemove, bookCatalog);
if (position != -1) {
bookCatalog[position] = null;
System.out.println("Book \"" + titleToRemove + "\" removed from the catalog.");
} else {
System.out.println("Book not found.");
}
}

public static int findBookPosition(String title, String[] bookCatalog) {
for (int i = 0; i < bookCatalog.length; i++) {
if (bookCatalog[i] != null && bookCatalog[i].equalsIgnoreCase(title)) {
return i;
}
}
return -1;
}
}