Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. package courseProject;
  2.  
  3. public class Book extends File{ //Book: id, Название, Автор (ы), Издательство, Год издания, Количество стра-ниц, Цена, Тип переплета.
  4.  
  5.  
  6. private String publishing;
  7. private int pages;
  8.  
  9. public Book() {
  10. }
  11.  
  12. public Book(int id, String name, String author, int year, String publishing, int pages) {
  13. super(id, name, author, year);
  14. this.publishing = publishing;
  15. this.pages = pages;
  16. }
  17.  
  18. public String getPublishing() {
  19. return publishing;
  20. }
  21.  
  22. public Book setPublishing(String publishing) {
  23. this.publishing = publishing;
  24. return this;
  25. }
  26.  
  27.  
  28. public int getPages() {
  29. return pages;
  30. }
  31.  
  32. public Book setPages(int pages) {
  33. this.pages = pages;
  34. return this;
  35. }
  36.  
  37.  
  38.  
  39. private void checkPages(int pages){
  40. if(!Validation.isPages(pages)){
  41. throw new IllegalArgumentException("Illegal pages");
  42. }
  43. }
  44.  
  45.  
  46.  
  47. @Override
  48. public String toString() {
  49. return "Book{" +
  50. ", publishing='" + publishing + '\'' +
  51. ", pages=" + pages +
  52. '}';
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement