Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: Java  |  size: 1.28 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. class Book
  2. {
  3.     // The fields.
  4.     private String author;
  5.     private String title;
  6.     private int pages;
  7.     private String refNumber;
  8.  
  9.     /**
  10.      * Set the author and title fields when this object
  11.      * is constructed.
  12.      */
  13.     public Book(String bookAuthor, String bookTitle, int amountPages, String setRef)
  14.     {
  15.  
  16.             refNumber = setRef;
  17.             author = bookAuthor;
  18.             title = bookTitle;
  19.             pages = amountPages;
  20.        
  21.     }
  22.    
  23. public Book(String bookAuthor, String bookTitle, int amountPages)
  24.     {
  25.             refNumber = "";
  26.             author = bookAuthor;
  27.             title = bookTitle;
  28.             pages = amountPages;
  29.      
  30.     }
  31.    
  32.     public String returnAuthor()
  33.     {
  34.         return author;
  35.     }
  36.    
  37.     public int getPages()
  38.     {
  39.         return pages;
  40.     }
  41.    
  42.     public String returnTitle()
  43.     {
  44.         return title;
  45.     }
  46.    
  47.     public void printAuthor()
  48.     {
  49.         System.out.println(author);
  50.     }
  51.    
  52.     public void printTitle()
  53.     {
  54.         System.out.println(title);
  55.     }
  56.    
  57.     public void printDetails()
  58.     {
  59.         System.out.println("Titel : " + title);
  60.         System.out.println("Auteur : " + author);
  61.         System.out.println("Aantal pagina's : " + pages);