package Methods; import java.util.Scanner; public class Library { int bookNo; String bookTitle; String yearOfPublish; long price; int tax; Library() // constructor. { bookNo = 0; bookTitle = ""; yearOfPublish = ""; tax =0; } public int getBookNo() { // they are usually Methods which return the value and there type is take nothing return something. return bookNo; } public String getBookTitle() { return bookTitle; } public long getPrice() { return price; } public String getYearOfPublish() { return yearOfPublish; } //setter also types of method which use to set the or change the value of variable; // Type of this method is Take something return nothing. public void setYearOfPublish(String yearOfPublish) { this.yearOfPublish = yearOfPublish; } public void setBookNo(int bookNo) { this.bookNo = bookNo; } public void setBookTitle(String bookTitle) { this.bookTitle = bookTitle; } public void setPrice(long price) { this.price = price; } // Function take nothing return nothing. public void printBook() { System.out.println("Book name is: "+bookTitle); System.out.println("Book publish date: "+yearOfPublish); System.out.println("Book id no: "+bookNo); System.out.println("Book price is: "+price); } // take something return something. public int sendTax(int t) { System.out.println("Enter the Tax: "); Scanner obj = new Scanner(System.in); tax=obj.nextInt(); tax+=t; return tax; } }