Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. OOP: Books
  2. 1. Create a public static class MarkTwainBook that inherits Book. Name of the author [Mark Twain].
  3. The constructor parameter is the book title.
  4. 2. Implement all the abstract methods in the MarkTwainBook class.
  5. 3. Change the return type of the getBook method to make it more appropriate.
  6. 4. In a similar manner, create the AgathaChristieBook class. Name of the author [Agatha Christie].
  7. 5. In the Book class, implement the getOutputByBookType method so that it returns:
  8. 5.1. agathaChristieOutput for books written by Agatha Christie;
  9. 5.2. markTwainOutput for books written by Mark Twain.
  10.  
  11.  
  12. Requirements:
  13. 1. The Solution class must contain the public static MarkTwainBook class.
  14. 2. The MarkTwainBook class must be a descendant of the Book class.
  15. 3. The MarkTwainBook class must correctly implement a constructor with one String parameter (book title).
  16. 4. The MarkTwainBook class constructor should call the constructor of the parent class (Book) with the argument "Mark Twain".
  17. 5. The getBook method in the MarkTwainBook class must have the MarkTwainBook return type and return the current object.
  18. 6. The Solution class must contain the public static AgathaChristieBook class.
  19. 7. The AgathaChristieBook class must be a descendant of the Book class.
  20. 8. The AgathaChristieBook class must correctly implement a constructor with one String parameter (book title).
  21. 9. The AgathaChristieBook class constructor should call the constructor of the parent class (Book) with the argument "Agatha Christie".
  22. 10. The getBook method in the AgathaChristieBook class must have the AgathaChristieBook return type and return the current object.
  23. 11. The getTitle method in the AgathaChristieBook and MarkTwainBook classes should return the title of a specific book.
  24. 12. The getOutputByBookType method must return the correct string for AgathaChristieBook objects.
  25. 13. The getOutputByBookType method must return the correct string for MarkTwainBook objects.
  26. 14. The MarkTwainBook class must have a String field title (book title).
  27. 15. The AgathaChristieBook class must have a String field title (book title).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement