Question: please remove all the errors in this code and include a main function import java.util.Scanner; public class Book { public void searchBySno(){ System.out.println(ttttSEARCH BY SERIAL

please remove all the errors in this code and include a main function

import java.util.Scanner;

public class Book { public void searchBySno(){

System.out.println("\t\t\t\tSEARCH BY SERIAL NUMBER ");

int sNo; System.out.println("Enter Serial No of Book:"); sNo = input.nextInt();

int flag = 0; System.out.println("S.No\t\tName\t\tAuthor\t\tAvailable Qty\t\tTotal Qty"); for (int i=0; i

if (sNo == Books[i].sNo){

System.out.println(Books[i].sNo + "\t\t" + Books[i].bookName + "\t\t" + Books[i].authorName + "\t\t" + Books[i].bookQtyCopy + "\t\t" + Books[i].bookQty); flag++; return;

}

} if (flag == 0) System.out.println("No Book for Serial No " + sNo + " Found.");

}

public void searchByAuthorName() {

System.out.println("\t\t\t\tSEARCH BY AUTHOR'S NAME"); input.nextLine(); System.out.println("Enter Author Name:"); String authorName = input.nextLine(); int flag = 0; System.out.println("S.No\t\tName\t\tAuthor\t\tAvailable Qty\t\tTotal Qty"); for (int i = 0; i < count; i++) {

if (authorName.equalsIgnoreCase(Books[i].authorName)) {

System.out.println(Books[i].sNo + "\t\t" + Books[i].bookName + "\t\t" + Books[i].authorName + "\t\t" + Books[i].bookQtyCopy + "\t\t" + Books[i].bookQty); flag++; }

} if (flag == 0) System.out.println("No Books of " + authorName + " Found."); } public void searchByBookName(){

System.out.println("\t\t\t\tSEARCH BY BOOK NAME"); input.nextLine(); System.out.println("Enter Book Name:"); String bookName = input.nextLine(); int flag = 0; System.out.println("S.No\t\tName\t\tAuthor\t\tAvailable Qty\t\tTotal Qty"); for (int i=0; i

if (bookName.equalsIgnoreCase(Books[i].authorName)){

System.out.println(Books[i].sNo + "\t\t" + Books[i].bookName + "\t\t" + Books[i].authorName + "\t\t" + Books[i].bookQtyCopy + "\t\t" + Books[i].bookQty); flag++; }

} if (flag == 0) System.out.println("No Books of " + bookName + " Found.");

}

public void showAllBooks(){

System.out.println("\t\t\t\tSHOWING ALL BOOKS "); System.out.println("S.No\t\tName\t\tAuthor\t\tAvailable Qty\t\tTotal Qty"); for (int i=0; i

System.out.println(Books[i].sNo + "\t\t" + Books[i].bookName + "\t\t" + Books[i].authorName + "\t\t" + Books[i].bookQtyCopy + "\t\t" + Books[i].bookQty); }

} public void requestNewBook(){ System.out.println("\t\t ENTER THE NAME AND AUTHOR NAME OF THE NEEDED BOOK "); System.out.println("Enter Book Name:"); String bookName = input.nextLine(); System.out.println(" Enter Author Name:"); String authorName = input.nextLine(); System.out.println("\t\t YOUR REQUEST HAS BEEN RECEIVED "); }

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!