-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathUsers.java
143 lines (115 loc) · 3.57 KB
/
Users.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package library;
import java.util.*;
import java.io.*;
/**
*
* @author Minahil Imtiaz
*/
abstract class Users {
// more attributes needed
private int user_id;
private String user_name;
private char gender;
Users() {
this.user_id = -1;
this.user_name = " ";
this.gender = '-';
}
Users(int user_id, String user_name, char gender) {
this.user_id = user_id;
this.user_name = user_name;
this.gender = gender;
}
public ArrayList<Books> SearchBookbyTitle(String title) {
// for (Books b : BooksList) {
// String titleofcurrentbook = b.GetTitle();
// if (titleofcurrentbook.contains(title) == true) {
// b.PrintInformation();
// } else {
// System.out.println("Sorry ! No record found \n");
//
// }
// }
ArrayList<Books> BooksList = new ArrayList<>();
dbConnectivity db = new dbConnectivity();
BooksList = db.SearchBookbyTitle(title);
// if (BooksList.isEmpty() == false) {
// for (Books b : BooksList) {
//
// b.PrintInformation();
// }
// } else {
// System.out.println("Sorry ! No record found \n");
//
// }
return BooksList;
}
public ArrayList<Books> SearchBookbySubject(String subject) {
ArrayList<Books> BooksList = new ArrayList<>();
dbConnectivity db = new dbConnectivity();
BooksList = db.SearchBookbySubject(subject);
// if (BooksList.isEmpty() == false) {
// for (Books b : BooksList) {
//
// b.PrintInformation();
// }
// } else {
// System.out.println("Sorry ! No record found \n");
//
// }
return BooksList;
}
public ArrayList<Books> SearchBookbyAuthor(String author) {
ArrayList<Books> BooksList = new ArrayList<>();
dbConnectivity db = new dbConnectivity();
BooksList = db.SearchBookbyAuthor(author);
return BooksList;
}
public int GetId() {
return this.user_id;
}
public String GetName() {
return this.user_name;
}
public char GetGender() {
return this.gender;
}
public void SetId(int id) {
this.user_id = id;
}
public void SetName(String name) {
this.user_name = name;
}
public void SetGender(char g) {
this.gender = g;
}
public String PrintInformation() {
String Resultant="Id: " + this.user_id+" "+"Name:" + this.user_name+" "+"Gender: " + this.gender+" ";
return Resultant;
}
void SetFineAmount(double fine)
{
dbConnectivity db= new dbConnectivity ();
db.SetFineAmount(user_id, fine);
}
boolean SetFineStatus(boolean status){
dbConnectivity db= new dbConnectivity ();
boolean result= db.SetFineStatus(user_id, status);
return result;
}
void UpdateLoanInfo(Loan L, int i ) {}
boolean GetFineStatus()
{
return true;
}
boolean AddLoanInfo(Loan Current_Loan)
{
return true;
}
abstract String ViewInformation(ArrayList<Loan> LoanLoanList, int user_id);
}