-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibrarymanagementsystem.java
More file actions
35 lines (32 loc) · 958 Bytes
/
librarymanagementsystem.java
File metadata and controls
35 lines (32 loc) · 958 Bytes
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
import java.util.ArrayList;
class book{
public String name, author;
}
class MyLibrary{
public ArrayList<book> books;
public MyLibrary(ArrayList<book> books){
this.books= book;
}
public void addbook(book book){
System.out.println("book has been added to library");
this.books.add(book);
}
public void issuedbook(book b){
System.out.println("book has been issued");
this.books.remove(b);
}
public void returnbook(book b){
System.out.println("book has been returned");
this.books.add(b);
}
}
public class librarymanagementsystem {
public static void main(String[] args) {
ArrayList<book> bk= new ArrayList<>();
bk.add(new book("m", "n"));
bk.add(new book("p", "q"));
MyLibrary l= new MyLibrary(bk);
l.addbook(new book("r", "t"));
System.out.println(l.books);
}
}