All pastes #762406 Raw Edit

Unnamed

public java v1 · immutable
·published 2007-11-05 17:31 UTC
rendered paste body
public class Book{   private String title;    private String ISBN;    private double qty; //quantity    private double price;    private Publisher publisher;    private Author author;    static int holdings;        public Book()    {   title = null;        ISBN = null;        qty = 0;        price = 0;        publisher = null;        author = null;//      holdings = 0;    }        public Book(String inTitle, String auLN, String auFN, int yr, String inISBN, double inPrice, double inQty, String pubName, String pubAddr, String pubPhone)    {   title = inTitle;        ISBN = inISBN;        qty = inQty;        price = inPrice;        publisher = new Publisher(pubName, pubAddr, pubPhone);        author = new Author(auLN, auFN, yr);        holdings ++;    }    public boolean setPrice(double inPrice)    {   price = inPrice;        return true;    }        public boolean changeQty(double inQty)    {   if ( inQty < 0 )        return false;        else         {   qty = inQty;            return true;        }    }        public boolean equals(Book book2)    {   return (ISBN.equals(book2.ISBN));    }        public int compareTo(Book book2)    {   return (title.compareTo(book2.title));    }        public String toString()    {   return (title + ' ' + author.toString() + ' ' + ISBN + ' ' + price + ' ' + qty + ' ' + publisher.toString() + ' ' + holdings);    }        public int getHoldings()    {   return holdings;    }}