-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAccount.java
58 lines (46 loc) · 1.17 KB
/
Account.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
import java.io.Serializable;
import java.util.LinkedList;
import java.util.Queue;
public class Account implements Serializable{
private Queue<Transaction> history;
private String ifsc;
private int accountNo;
private int pin;
private double balance;
Account(int accountNo ,int pin , String ifsc){
this.accountNo = accountNo;
this.pin = pin;
this.ifsc = ifsc;
balance = 0.0;
history = new LinkedList<Transaction>();
}
public int getAccountNo(){
return accountNo;
}
public String getifsc(){
return ifsc;
}
public int getPin(){
return pin;
}
public void setPin(int pin){
this.pin = pin;
}
public double getBalance(){
return balance;
}
public void setBalance(double bal){
balance = bal;
}
public Queue<Transaction> getHistory(){
return history;
}
public void addToHistory(Transaction t){
if(history.size() < 3){
history.add(t);
}else{
history.poll();
history.add(t);
}
}
}