-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransaction.java
More file actions
31 lines (31 loc) · 969 Bytes
/
Copy pathTransaction.java
File metadata and controls
31 lines (31 loc) · 969 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
import java.util.*;
import java.io.*;
public class Transaction implements Serializable {
private static final long serialVersionUID = 1L;
private String type;
private String title;
private Calendar date;
public Transaction (String type, String title) {
this.type = type;
this.title = title;
date = new GregorianCalendar();
date.setTimeInMillis(System.currentTimeMillis());
}
public boolean onDate(Calendar date) {
return ((date.get(Calendar.YEAR) == this.date.get(Calendar.YEAR)) &&
(date.get(Calendar.MONTH) == this.date.get(Calendar.MONTH)) &&
(date.get(Calendar.DATE) == this.date.get(Calendar.DATE)));
}
public String getType() {
return type;
}
public String getTitle() {
return title;
}
public String getDate() {
return date.get(Calendar.MONTH) + "/" + date.get(Calendar.DATE) + "/" + date.get(Calendar.YEAR);
}
public String toString(){
return (type + " " + title);
}
}