Question: In Java please. You are tasked with writing a code for the classes for a basic library management system using inheritance in Java. 1 .

In Java please. You are tasked with writing a code for the classes for a basic library management system using inheritance in Java.
1. Create a base class named Item with the following attributes and methods:
- string title
- string authorOrPublisher
Constructor and methods of item class:
- a constructor to initialize the attributes
- A toString() method to print the item details
2) create to derived classes named Book and Magazine that inherit from the Item class:
Book class, inherits from item class with following structure
- additional attribute: int numberOfPages
- override the toString() method to include numberOfPages
Magazine class inherits from item class with the following structure
- additional attribute: int numberOfPages
- override the toString() method to include issueNumber
3 write a test class with main method performing following tasks:
- create an array of item references that holds both book and magazine objects
- populate the array with the 2 book and magazine objects provided in the table in the attached photo
- loop through the array and display details of magazine or book from array of items so that toString method for each object is called implicitly
4) to the test class add searchByTitle method that takes a string as input and searches for an item by its title in the array. If found, it prints the details, otherwise it prints an error message on the console that displays Title not found
Please include a screenshot of the compiled code working, thanks!
In Java please. You are tasked with writing a

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!