/**
 * A class that maintains information on a book.
 * This might form part of a larger application such
 * as a library system, for instance.
 *
 * @author (Insert your name here.)
 * @version (Insert today’s date here.)
 */
public class Book
{
    // The fields.
    private String author; 
    private String title;
    private int pages;
    private String refNumber;
    private int borrowed;
    /**
     * Set the author and title fields when this object
     * is constructed.
     */

    public Book(String bookAuthor, String bookTitle, int bookPages)
    {
        author = bookAuthor;
        title = bookTitle;
        pages = bookPages;
        refNumber = "";
    }

    public void printAuthor(){
        System.out.println(author);
    }
    
    public void printTitle(){
        System.out.println(title);
    }
    
    public int getPages(){
        return pages;
    }
    
    public void setRefNumber(String ref){
        if(ref.length()>=3){
            refNumber = ref;
        } else {
            System.out.print("enter a ref of 3 or more characters");
        }
    }
    
    public int getBorrowed(){
        return  borrowed;
    }
    
    public void setBorrowed(String ref){
        borrowed += 1;
    }
    
    public String getRefNumber(){
        return refNumber;
    }
    
    public void printDetails(){
        System.out.println("Title: " + title + ", Author: " + author + ", Pages: " + pages + ", Checkouts: " + borrowed);
    }
}
    
    