Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.79 KB | None | 0 0
  1. abstract class Citation {
  2.  
  3.     private Pearson[] author;
  4.     private String title;
  5.     private int year;
  6.  
  7.     public Citation(Pearson[] author, String title, int year) {
  8.         this.author = author;
  9.         this.title = title;
  10.         this.year = year;
  11.     }
  12.  
  13.     public Pearson[] getAuthor() {
  14.         return author;
  15.     }
  16.  
  17.     public String getTitle() {
  18.         return title;
  19.     }
  20.  
  21.     public int getYear() {
  22.         return year;
  23.     }
  24.  
  25.     public abstract int getPagesCount();
  26. }
  27.  
  28.  
  29. class Book extends Citation {
  30.  
  31.     private String publisher;
  32.  
  33.     private String address;
  34.  
  35.     private int pagesCount;
  36.  
  37.     public Book(Pearson[] author, String title, int year, String publisher, String address, int pagesCount) {
  38.         super(author, title, year);
  39.         this.publisher = publisher;
  40.         this.address = address;
  41.         this.pagesCount = pagesCount;
  42.     }
  43.  
  44.     @Override
  45.     public int getPagesCount() {
  46.         return pagesCount;
  47.     }
  48. }
  49.  
  50.  
  51. class InCollection extends Book {
  52.  
  53.     private String bookTitle;
  54.  
  55.     private Pearson[] editors;
  56.  
  57.     private int startPage;
  58.  
  59.     private int endPage;
  60.  
  61.     public InCollection(Pearson[] author, String title, int year, String publisher, String address, String bookTitle, Pearson[] editors, int startPage, int endPage) {
  62.         super(author, title, year, publisher, address, endPage-startPage);
  63.         this.bookTitle = bookTitle;
  64.         this.editors = editors;
  65.         this.startPage = startPage;
  66.         this.endPage = endPage;
  67.  
  68.     }
  69.  
  70.     public String getBookTitle() {
  71.         return bookTitle;
  72.     }
  73.  
  74.     public Pearson[] getEditors() {
  75.         return editors;
  76.     }
  77.  
  78.     public int getStartPage() {
  79.         return startPage;
  80.     }
  81.  
  82.     public int getEndPage() {
  83.         return endPage;
  84.     }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement