-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibrary_Item.java
More file actions
49 lines (42 loc) · 1.23 KB
/
Library_Item.java
File metadata and controls
49 lines (42 loc) · 1.23 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
public class Library_Item {
protected String itemId;
protected String Tittle;
protected Boolean isAvailable;
public Library_Item(String itemId,String Tittle){
this.itemId=itemId;
this.Tittle=Tittle;
this.isAvailable=true;
}
public String getItemId() {
return itemId;
}
public void borrowItem() {
if(isAvailable==true){
System.out.println("The Book " + Tittle+" is available!!");
isAvailable=false;
System.out.println("The Book " + Tittle+" is Issued.");
}
else{
System.out.println("The Book " + Tittle+" is not available");
}
}
public void returnItem(){
if(isAvailable==false){
isAvailable=true;
System.out.println("Item returned successfully!!");
}
System.out.println("The Book " + Tittle+" returned successfully!!");
}
Author obj ;
public void displayDetails(){
System.out.println("Book id is : "+itemId);
System.out.println("Tittle of the book is : "+Tittle);
//System.out.println("Author is : "+obj.getName());
if(isAvailable==true){
System.out.println("Book is available!!");
}
else{
System.out.println("Book is not available");
}
}
}