vault backup: 2024-02-20 13:05:19

This commit is contained in:
2024-02-20 13:05:19 +00:00
parent 7f6d033cc4
commit 0134f066d6
45 changed files with 1429 additions and 76 deletions

View File

@@ -0,0 +1,38 @@
/**
* 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 );
}
}
}