Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.41 KB | None | 0 0
  1.  private abstract class Citation {
  2.  
  3.         private Person[] authors;
  4.         private String title;
  5.         private int year;
  6.  
  7.         public Citation(Person[] authors, String title, int year) {
  8.             this.authors = authors;
  9.             this.title = title;
  10.             this.year = year;
  11.         }
  12.  
  13.         public Person[] getAuthors() {
  14.             return authors;
  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.     private class Book extends Citation {
  30.  
  31.         private String publisher;
  32.  
  33.         private String address;
  34.  
  35.         private int pagesCount;
  36.  
  37.         public Book(Person[] 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.     private class InCollection extends Book {
  52.  
  53.         private String bookTitle;
  54.  
  55.         private Person[] editors;
  56.  
  57.         private int startPage;
  58.  
  59.         private int endPage;
  60.  
  61.         public InCollection(Person[] author, String title, int year, String publisher, String address, String bookTitle, Person[] 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 Person[] getEditors() {
  75.             return editors;
  76.         }
  77.  
  78.         public int getStartPage() {
  79.             return startPage;
  80.         }
  81.  
  82.         public int getEndPage() {
  83.             return endPage;
  84.         }
  85.     }
  86.  
  87.  
  88.     private class Person {
  89.  
  90.         String name;
  91.  
  92.         String surname;
  93.  
  94.         public Person(String name, String surname) {
  95.             this.name = name;
  96.             this.surname = surname;
  97.         }
  98.  
  99.         public String getName() {
  100.             return name;
  101.         }
  102.  
  103.         public String getSurname() {
  104.             return surname;
  105.         }
  106.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement