/** * A class that maintains information on a book. * This might form part of a larger application such * as a library system, for instance. * * @author John Sloan * @version 1-22-2008 */ public class Book { // The fields. private String author; private String title; private int pages; private String refNumber; /** * Set the author and title fields when this object * is constructed. */ public Book(String bookAuthor, String bookTitle, int bookPage) { author = bookAuthor; title = bookTitle; pages = bookPage; refNumber = ""; } /** * First of two accessor methods from lab assignment. */ //Add the methods here... public String getAuthor() { return author; } /** * Second of two accessor methods from lab assignment. */ //add the methods here... public String gettitle() { return title; } /** * Third accessor method requests page number. */ //add the methods here... public int getPage () { return pages; } /** * Prints the author field to the terminal window. */ //Add print method here. public void printAuthor() { System.out.println ( "The author is " + author ); } /** * Prints the title field to the terminal window. */ //Add print method here. public void printTitle() { System.out.println ( "the title is " + title ); } /** * This mutator method is for finding the reference number. */ //First Mutator method. public void setRefNumber ( String ref ) { refNumber = ref; } /** * Accessor for setRefNumber. */ // public String getRefNumber () { return refNumber; } /** * This method prints the details to the terminal window. * Details include author, title, and pages. */ public void printDetails () { System.out.println ( "author " + author ); System.out.println ( "title " + title ); System.out.println ( "pages " + pages ); } }