public class Book { public static String description="I am a class modelling a book entity"; private static int readingSpeed= 30; private String author; private String title; private int pageCount; private int currentPage; //The default constructor. It doesn't take any input arguments. //You can refer within methods to any variable by just using its name. There is no need for keyword this public Book() { author=""; title=""; currentPage=1; } //Another constructor for initializing author and title while creating the corresponding object. //We need the keyword this to refer to instance variables, because method parameters have //the same names and overshadow the instance variables public Book(String author, String title, int pageCount){ this.author=author; this.title=title; this.pageCount=pageCount; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getCurrentPage() { return currentPage; } // We are assuming currentPage neves exceeds pageCount. Normally we need to check if this constraint holds // before updating the value of the variable currentPage. Try to do that as exercise! public void setCurrentPage(int currentPage) { this.currentPage = currentPage; } public void turnPage() { currentPage++; } public String toString() { return title+" "+author; } public boolean equals(Book b) { if(this.author.equals(b.getAuthor()) && this.title.equals(b.getTitle())){ return true; } return false; } public int getEstimatedTimeLeft() { int timeleft= (pageCount-currentPage)*readingSpeed; return timeleft; } public int getPageCount() { return pageCount; } public void setPageCount(int pageCount) { this.pageCount = pageCount; } }