Files

48 lines
1.2 KiB
Java

/**
* Write a description of class Book here.
*
* @author (your name)
* @version (a version number or a date)
*/
import java.util.Scanner;
import java.util.ArrayList;
import java.util.NoSuchElementException;
public class Book extends LibraryItem
{
private String title;
private String itemCode;
private int cost;
private int timesBorrowed;
private boolean onLoan;
private String author;
private int isbn;
/**
* Constructor for objects of class Book
*/
public Book()
{
this.title = "";
this.itemCode = "";
this.cost = 0;
this.timesBorrowed = 0;
this.author = "";
this.isbn = 0;
}
public void readItemData( Scanner detailScanner ){
if ( detailScanner != null ) {
this.title = detailScanner.next().trim();
this.itemCode = detailScanner.next().trim();
this.cost = Integer.parseInt( detailScanner.next() );
this.timesBorrowed = Integer.parseInt( detailScanner.next() );
this.onLoan = Boolean.parseBoolean( detailScanner.next() );
this.author = detailScanner.next().trim();
this.isbn = Integer.parseInt( detailScanner.next() );
}
}
}