Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. /**
  2.  * A class that maintains information on a book.
  3.  * This might form part of a larger application such
  4.  * as a library system, for instance.
  5.  *
  6.  * @author (Jonah Broyer)
  7.  * @version (1/18/2020)
  8.  */
  9. class Book
  10. {
  11.     // The fields.
  12.     private String author;
  13.     private String title;
  14.  
  15.     /**
  16.      * Set the author and title fields when this object
  17.      * is constructed.
  18.      */
  19.     public Book(String bookAuthor, String bookTitle)
  20.     {
  21.         author = bookAuthor;
  22.         title = bookTitle;
  23.     }
  24.  
  25.     /**
  26.      * Exercise 2.83
  27.      * Return the author of the book.
  28.      */
  29.     public String getAuthor()
  30.     {
  31.         return author;
  32.     }
  33.    
  34.     /**
  35.      * Exercise 2.83
  36.      * Return the title of the book.
  37.      */
  38.     public String getTitle()
  39.     {
  40.         return title;
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement