-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankObject.java
More file actions
138 lines (107 loc) · 3.73 KB
/
Copy pathBankObject.java
File metadata and controls
138 lines (107 loc) · 3.73 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
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
package debuggingec;
import java.util.List;
/**
*
* @author Kevin Jang
*/
public class BankObject {
public int age;
public String job;
public String marriageStatus;
public String education;
public boolean defaulted;
public double balance;
public boolean housing;
public boolean loan;
public boolean subscribed;
public int size;
/*To fix most issues in here, I removed the 'final' part
of the code because the final does not allow for the data
type to change.*/
BankObject(List data){
try{
if(data.size() <= 11){//constructor, made it <= not ==
this.age = Integer.parseInt(data.get(0).toString());
this.job = data.get(1).toString();
this.marriageStatus = data.get(2).toString();
this.education = data.get(3).toString();
this.defaulted = data.get(4).toString().equalsIgnoreCase("yes");
this.balance = Double.parseDouble(data.get(5).toString());
this.housing = data.get(6).toString().equalsIgnoreCase("yes");
this.loan = data.get(7).toString().equalsIgnoreCase("yes");
this.subscribed = data.get(8).toString().equalsIgnoreCase("yes");
this.size = 10;
}
} catch(NumberFormatException e){
System.out.println("Wrong array size.");
e.printStackTrace();
}
}
//@Getters
public int getAge(){
return this.age;
}
public String getJob(){
return this.job;
}
public String getMarriageStatus(){
return this.marriageStatus;
}
public String getEducation(){
return this.education;
}
public boolean getDefaulted(){
return this.defaulted;
}
public Double getBalance(){
return this.balance;
}
public boolean getHousing(){
return this.housing;
}
public boolean getLoan(){
return this.loan;
}
public boolean getSubscribed(){
return this.subscribed;
}
public int getSize(){
return this.size;
}
//@Setters
public void setAge(int age_Param){
this.age = age_Param;
}
public void setJob(String job_Param){
this.job = job_Param;
}
public void setMarriageStatus(String marriage_Param){
this.marriageStatus = marriage_Param;
}
public void setEducation(String education_Param){
this.education = education_Param;
}
public void setDefauled(String defaulted_Param){
this.defaulted = defaulted_Param.equalsIgnoreCase("yes");
}
public void setBalance(Double balance_Param){
this.balance = balance_Param;
}
public void setHousing(String housing_Param){
this.housing = housing_Param.equalsIgnoreCase("yes");
}
public void setLoan(String loan_Param){
this.loan = loan_Param.equalsIgnoreCase("yes");
}
public void setSubscribed(String subscribed_Param){
this.subscribed = subscribed_Param.equalsIgnoreCase("yes");
}
public double toDouble(int number){
double returnValue = number;
return returnValue;
}
@Override
public String toString(){
return "[Age: " + this.age + ", Job: " + this.job + ", Education: " + this.education + ", Defaulted: " + this.defaulted + ", Balance: " + this.balance + ", Housing: " + this.housing + ", Loan: " + this.loan + ", Subscribed: " + this.subscribed + "]";
}
}