-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathKidUsers.java
47 lines (36 loc) · 984 Bytes
/
KidUsers.java
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
package LibraryUsersAssignment;
public class KidUsers implements LibraryUser {
private int age = 12;
private String bookType = "kids";
protected int getAge() {
return age;
}
protected void setAge(int age) {
this.age = age;
}
protected String getBookType() {
return bookType;
}
protected void setBookType(String bookType) {
this.bookType = bookType;
}
@Override
public void registerAccount() {
if (getAge() < 12) {
System.out.println("You have successfully registered under a Kids Account");
} else {
System.out.println("Sorry, Age must be less than 12 to register as a kid");
}
}
@Override
public void requestbook() {
if (getAge() < 12 && getBookType() == bookType) {
System.out.println("Book Issued successfully, please return the book within 10 day");
} else {
System.out.println("Oops, you are allowed to take only kids books");
}
}
@Override
public void name() {
}
}