vault backup: 2024-02-20 13:05:19
This commit is contained in:
47
Semester 2/Programming 2/Project/Part 1/Book.java
Normal file
47
Semester 2/Programming 2/Project/Part 1/Book.java
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
/**
|
||||
* 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() );
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user