Map-based implementation

Report a typo

Write an implementation of the BookDao interface using the Map data structure. Do not print any messages inside your implementation code and not change the provided code of the classes.

Sample Input 1:

0
The Lord of the Rings
1
Pride and Prejudice
10

Sample Output 1:

Found Book [id 0, title : The Lord of the Rings]
Not found id 10
Found Book [id 1, title : Pride and Prejudice]
Updated Book [id 1, title : UPDATED]
Deleted id: 1
Write a program in Java 17
import java.util.*;

interface BookDao {

void add(Book book);

Book get(int id);

void update(Book book);

void delete(int id);
}

class BookDaoImpl implements BookDao {
private final Map<Integer, Book> books;

public BookDaoImpl() {
this.books = new HashMap<>();
}

@Override
public void add(Book book) {
// write your code here
}

@Override
public Book get(int id) {
// write your code here
}

@Override
public void update(Book book) {
// write your code here
}

@Override
___

Create a free account to access the full topic