-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransaction.java
More file actions
34 lines (32 loc) · 769 Bytes
/
Transaction.java
File metadata and controls
34 lines (32 loc) · 769 Bytes
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
public class Transaction {
private String type;
private double amount;
private String detail;
private long timestamp;
//constructor 1
public Transaction(String type,double amount,String detail){
this.type=type;
this.amount=amount;
this.detail=detail;
this.timestamp=System.currentTimeMillis();
}
//access type
public String getType(){
return type;
}
//access amount
public double getAmount(){
return amount;
}
//access Timestamp
public long getTimestamp(){
return timestamp;
}
public String getDetail(){
return detail;
}
//overriding toString
public String toString(){
return type+"|Rs."+amount+"|"+detail;
}
}