Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1.  
  2. public class Book {
  3. private String author;
  4. private String title;
  5. private Genre genre;
  6.  
  7. public Book() {
  8. author ="";
  9. title = "";
  10. genre = null;
  11. }
  12.  
  13.  
  14.  
  15. public Book(String author, Genre genre, String title) {
  16. this.author = author;
  17. this.genre = genre;
  18. this.title = title;
  19. }
  20.  
  21. public String getAuthor() {
  22. return author;
  23. }
  24.  
  25. public void setAuthor(String author) {
  26. this.author = author;
  27. }
  28.  
  29. public Genre getGenre() {
  30. return genre;
  31. }
  32.  
  33. public void setGenre(Genre genre) {
  34. this.genre = genre;
  35. }
  36.  
  37. public String getTitle() {
  38. return title;
  39. }
  40.  
  41. public void setTitle(String title) {
  42. this.title = title;
  43. }
  44.  
  45. public static void printBook(Book book){
  46. System.out.println(book.author + " " + book.title + " " + book.genre);
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement