/** * Subclass of LibraryItem that emulates a Book item. * * @George Wilkinson * @2.5 */ import java.util.Scanner; import java.util.NoSuchElementException; public class Book extends PrintedItem { private String author; private String isbn; /** * Constructor for objects of class Book * Since all field variables initialise as null, nothing should happen here. */ public Book(){} /* * Return value of @author */ public String getAuthor() { return author; } /* * Return value of @isbn. */ public String getIsbn() { return isbn; } /* * Set value of @author. */ public void setAuthor( String author ) { this.author = author; } /* * Set value of @isbn */ public void setIsbn( String isbn ) { this.isbn = isbn; } /* * Print to terminal, relevant details of current object. */ public void printDetails() { System.out.println( "ISBN: " + isbn + "\nAuthor: " + author ); super.printDetails(); } /** * Populate the fields with details from the scanner * Takes Parameters * Scanner @detailScanner */ public void readItemData( Scanner detailScanner ){ if ( detailScanner != null ) { this.author = detailScanner.next().trim(); this.isbn = detailScanner.next().trim(); super.readItemData( detailScanner ); } } }