-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStatistic.java
More file actions
58 lines (55 loc) · 1.13 KB
/
Statistic.java
File metadata and controls
58 lines (55 loc) · 1.13 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
/**
* @author kolovsky
* @author jmacura
* @version 1.00.000
*/
class Statistic{
//public int allFoodHelp = 0;
/**
* Pole pro zaznamy o dovezenych potravinach.
*/
public String [] log = new String[8];
/**
* Pole s poctem surovin, dovezenym za 3 dny.
*/
public int [] threeFood = new int[3];
/**
* konstruktor
*/
public Statistic(){
for (int i = 0;i<log.length ;i++ ) {
log[i] = "";
}
for (int i = 0;i<threeFood.length ;i++ ) {
threeFood[i] = 0;
}
}
/**
* Prida zaznam.
* @param kolik Pocet surovin.
*/
public void addLog(int kolik){
log[Core.c.time/1440] += "("+Core.c.time+" "+kolik+" kg)";
threeFood[Core.c.time/4320] += kolik;
}
/**
* Vytvori statistiku v citelne podobe.
* @return Statisticka data
*/
public String toString(){
String out = "";
for (int i = 0;i<7 ;i++ ) {
out = out + i+". den: ";
out = out +log[i] + " ";
}
out = out + "\n";
int allFood = 0;
for (int j = 0;j<3 ;j++ ) {
out = out + j+". trojden: "+threeFood[j]+" kg ";
allFood += threeFood[j];
}
out = out + "\n";
out = out + "Celkova dovezena pomoc: "+allFood;
return out;
}
}