Question: Create a simplistic library system consisting of (only) books and magazines. Objects in your system: Book Has a title of type String Has an author

Create a simplistic library system consisting of (only) books and magazines. Objects in your system:

Book

  • Has a title of type String
  • Has an author of type String
  • Has a publisher of type String

Magazine

  • Has a title of type String
  • Has a publisher of type String
  • Has a print date of type LocalDate

Library

  • Has a main() method
  • Creates three published works:
    • A book of title \"Crime and Punishment\" with author \"Dostoevsky\" and publisher of \"Simon and Schuster\"
    • A magazine of title \"Sports Illustrated\" with publisher \"Random House\" and print date of 01/31/2008
    • A book of title \"The Hobbit\" with author \"Tolkien\" and publisher \"Harper Collins\"
  • Has a method named printCollection() that will print N (any number) of published works using a toString() method that includes the class name by using \"this.getClass()\". See lesson videos for an example.

Your solution:

  1. Must be formatted with extra empty lines removed and proper indentation. Use CTRL-SHIFT-F (or Mac equivalent)!
  2. Must leverage inheritance
  3. Must match the following output exactly when executed with the test published works as stated above:

class lib.Book: {title=Crime and Punishment,publisher=Simon and Schuster} class lib.Book: {title=The Hobbit,publisher=Harper Collins} class lib.Magazine: {title=Sports Illustrated,publisher=Random House

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!