Question: The following program contains a few blanks ( A - E ) . The program models a library where different types of items such as

The following program contains a few blanks (A-E). The program models a library where different types of items such as books and journals can be borrowed. Each library item has an ID and a title. The system should be expandable to allow the addition of more types of library items in the future. Fill in the blanks for the correct execution of the program. Your program should compile and run without any errors, and it should produce the following output: Book borrowed: "Effective Java"Journal borrowed: "Nature Journal, September 2023"[2*5=10 marks] Java code:abstract class LibraryItem { private final String id; private final String title; LibraryItem(String id, String title){ this.id = id; this.title = title; } void borrowItem(){ System.out.println(----A----+" borrowed: \""+ title +"\"");//Fill A to print the class name using Reflection API methods } String getId(){ return id; } String getTitle(){ return title; }} class Book extends LibraryItem { Book(String id, String title){----B----(id, title); }} class Journal extends LibraryItem { Journal(String id, String title){----C----(id, title); }} public class Main { public static void main(String[] args){ LibraryItem book = new Book ("1", "Effective Java"); LibraryItem journal = new Journal("2", "Nature Journal, September 2023"); ----D----; // call the borrowItem ----E----; // call the borrowItem }}

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!