Write a constructor for Book. The constructor will take the…
Write a constructor for Book. The constructor will take the title, author, and pageCount, and set all instance variables appropriately. If the pageCount is negative or 0, set it to 1. The constructor should also update the totalBooks variable to reflect that a new Book exists.
Read DetailsWrite a concrete toString method for Book. The String repres…
Write a concrete toString method for Book. The String representation of a Book is “[title] by [author] has [pageCount] pages remaining” (without the square brackets, replacing the square brackets with the values from the indicated instance variables).
Read DetailsWrite a protected visibility method for Book called updatePa…
Write a protected visibility method for Book called updatePages. The method should take one parameter, which is an int, and it returns nothing. This method should subtract the number of pages read (the parameter) from the Book’s current pageCount. If the subtraction results in a negative number or zero, set pageCount to 0.
Read Details