1. Methods to search for a book
    If the user chooses that option he should be asked of he wants to search for it using the book’s title (or part of it) or using the name of one of the authors (or part of the name)
    Depending on that search the user should go through the “Library.txt” file and print all the books matching that certain criteria. And if none was found an appropriate message should be printed. (the search needs to be case sensitive as the user can search using lower case letters or upper case one)

What do you need asap? I assume this is a homework assignment? Where are you stuck? What do you have so far?

commented: public static void main(String[] args)throws InterruptedException{ Scanner rr = new Scanner(System.in); System.out.println("D +0

so this is my work so far its not completed yet, but all I know is were going to us if statement but what confuses is trying to get the decisions out of the user for ex author or book title or yes or no:

public static void main(String[] args)throws InterruptedException{
Scanner rr = read Scanner(System.in);

    System.out.println("Do you want to search for a book?: ");
    String N = rr.next();
    String y = "yes";
    String n = "no";

    if(n.equalsIgnoreCase("No")) {
        System.out.println("Thank you!");

    else(n.equalsIgnorCase("Yes"))
        System.out.println("Search by author or book title: ");

            {
    }
        System.out.println("Thank you! ");
    else if(N.equals("yes"))
        System.out.println("Search by 'author' or 'book title': ");

You are almost there for the yes/no.
You correctly read the user's input into the variable N, but then you compare the wrong variable (n) with "No" and `"Yes".

It really helps if you give variables meaningful names because the code is then easier to read, and mistakes are more obvious,
Eg compare your code with this (just the names changed)

String userReply = scanner.next();
if (userReply.equalsIgnoreCase("no")). etc
class Program {
  public static void main(String[] args)
      throws InterruptedException {
    //Scanner rr = read Scanner(System.in);
    Scanner rr = new Scanner(System.in);
    System.out.println(
      "Do you want to search for a book?: ");

    String N = rr.next();
    String y = "yes";
    String n = "no";

    // if(n.equalsIgnoreCase("No")) { 
    if (N.equalsIgnoreCase(n)) {
      System.out.println("Thank you!");
    } // added
    else
    // (n.equalsIgnorCase("Yes"))
    if (N.equalsIgnoreCase(y)) {
      System.out.println(
        "Search by author or book title: ");
    } // added
    //{ 
  }
} // added
commented: That's better. Do you have any more questions? +15
commented: I appreciate it <3 +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.