Advertisement
arafaee

Book.java

Apr 17th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1.  
  2. /**
  3. * 8.10 Book.java
  4. *
  5. * @author Hafara Firdausi/ 5115100043
  6. * @version 01
  7. */
  8.  
  9. public enum Book
  10. {
  11. // declare constants of enum type
  12. JHTP("Java How to Program", "2012"),
  13. CHTP("C How to Program", "2007"),
  14. IW3HTP("Internet & World Wide Web How to Program", "2008"),
  15. CPPHTP("C++ How to Program", "2012"),
  16. VBHTP("Visual Basic 2010 How to Program", "2011"),
  17. CSHARPHTP("Visual C# 2010 How to Program", "2011");
  18.  
  19. // instance fields
  20. private final String title; // book title
  21. private final String copyrightYear; // copyright year
  22.  
  23. // enum constructor
  24. Book(String bookTitle, String year)
  25. {
  26. title = bookTitle;
  27. copyrightYear = year;
  28. } // end enum Book constructor
  29.  
  30. // accessor for field title
  31. public String getTitle()
  32. {
  33. return title;
  34. } // end method getTitle
  35.  
  36. // accessor for field copyrightYear
  37. public String getCopyrightYear()
  38. {
  39. return copyrightYear;
  40. } // end method getCopyrightYear
  41. } // end enum Book
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement