FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java-Library-Management-Pro/Book.java at main · Wadan3/Java-Library-Management-Pro · GitHub
Wadan3
/
Java-Library-Management-Pro
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
23
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java-Library-Management-Pro
/
Book.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
48 lines (40 loc) · 1.06 KB
Breadcrumbs
Java-Library-Management-Pro
/
Book.java
Copy path
File metadata and controls
48 lines (40 loc) · 1.06 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
class
Book
{
private
String
id
;
private
String
title
;
private
String
author
;
private
boolean
isAvailable
;
public
Book
(
String
id
,
String
title
,
String
author
) {
if
(
id
.
length
() !=
5
) {
throw
new
IllegalArgumentException
(
"It should 5 character!!!"
);
}
this
.
id
=
id
;
this
.
title
=
title
;
this
.
author
=
author
;
this
.
isAvailable
=
true
;
}
public
String
getId
() {
return
id
;
}
public
String
getTitle
() {
return
title
;
}
public
String
getAuthor
() {
return
author
;
}
public
boolean
isAvailable
() {
return
isAvailable
;
}
public
void
borrow
() {
if
(
isAvailable
) {
isAvailable
=
false
;
}
else
{
throw
new
IllegalStateException
(
"Book is not available."
);
}
}
public
void
returnBook
() {
isAvailable
=
true
;
}
public
void
printBookInfo
() {
System
.
out
.
println
(
"ID: "
+
id
+
", Title: "
+
title
+
", Author: "
+
author
+
", Available: "
+
isAvailable
);
}
}
Back
|
FazBrowse Home
|
New Git URL