-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExport.java
More file actions
31 lines (26 loc) · 1008 Bytes
/
Export.java
File metadata and controls
31 lines (26 loc) · 1008 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.List;
import java.util.Random;
public class Export {
private int id, orderedDate, shippedDate, location;
private String orderedDateStr, shippedDateStr;
private double cost;
private Random rand = new Random();
public Export(List<String> dates, int seq, int firstImp) {
id = 1000 + seq;
orderedDate = firstImp + rand.nextInt(dates.size() - (firstImp - 986));
orderedDateStr = dates.get(orderedDate - 1000);
shippedDate = orderedDate + 5 + rand.nextInt(10);
shippedDateStr = dates.get(shippedDate - 1000);
cost = Math.round((10 + (rand.nextDouble() * 20)) * 100.0) / 100.0;
location = 1000 + rand.nextInt(10);
}
public String toString() {
return String.valueOf(orderedDateStr) + ',' + String.valueOf(shippedDateStr) + ',' + String.valueOf(cost) + ',' + String.valueOf(location);
}
public int getID() {
return id;
}
public int getDate() {
return orderedDate;
}
}