/** * Subclass of LibraryItem that emulates a Book item in a Library * * @George Wilkinson * @1.0 */ import java.util.Scanner; import java.util.ArrayList; import java.util.NoSuchElementException; public class Book extends LibraryItem { private String author; private String isbn; /** * Constructor for objects of class Book */ public Book(){} public void printDetails() { System.out.println("\n==================\n( " + getItemCode() + " )" + " ISBN: " + isbn + " Book " + getTitle() + ", written by " + author + ", published by " + getPublisher() + " has " + getNoOfPages() + " pages .\nIt has been borrowed " + getTimesBorrowed() + " times."); if( getOnLoan() ) System.out.println( "The Book is currently on loan, and costs " + getCost() + " pence. "); else System.out.println( "The Book is currently not on loan, and costs " + getCost() + " pence. "); } public void readItemData( Scanner detailScanner ){ if ( detailScanner != null ) { this.author = detailScanner.next().trim(); this.isbn = detailScanner.next().trim(); super.readItemData( detailScanner ); } } }