-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibraryManager.java
More file actions
70 lines (62 loc) · 1.72 KB
/
Copy pathLibraryManager.java
File metadata and controls
70 lines (62 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import java.util.ArrayList;
import java.util.List;
public class LibraryManager implements Manageable<Library> {
private List<Library> BookList;
public LibraryManager() {
// Initialize the studentList as an empty list
BookList = new ArrayList<>();
}
@Override
public void add(Library library) {
BookList.add(library);
System.out.println("[+] Book Added: " + library.getISBN() );
}
@Override
public void update(Library library) {
// Assuming student information can be updated based on some criteria, implement the update logic here.
// You might want to find the student in the list and update their information.
// No Need to implement this method .!
}
@Override
public void delete(Library library) {
BookList.remove(library);
System.out.println("[-] Student deleted: " + library.getISBN() );
}
@Override
public List<Library> list() {
return BookList;
}
}
class Library{
private String ISBN;
private String title;
private String author;
Library(String ISBN,String title, String author){
this.ISBN=ISBN;
this.title=title;
this.author=author;
}
String getISBN(){
return ISBN;
}
String getTitle(){
return title;
}
String getAuthor(){
return author;
}
void setISBN(String ISBN){
this.ISBN=ISBN;
}
void setTitle(String title){
this.title=title;
}
void setAuthor(String author){
this.author=author;
}
public String toString() {
return "ISBN : " + ISBN + "\n" +
"TItle : " + title + "\n" +
"Author's name: " + author + "\n" ;
}
}