-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRun.java
More file actions
96 lines (84 loc) · 2.08 KB
/
Copy pathRun.java
File metadata and controls
96 lines (84 loc) · 2.08 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import java.text.DecimalFormat;
/**
* This class contains all the information
* associated with an individual run
*
* @author skgigliotti
*
*/
class Run{
private int tMin;
private int tSec;
private double distance;
private String date;
private int mood;
private String pace;
private int exhaustion;
DecimalFormat format = new DecimalFormat("##.00");
/**
*
* @param dist double total distance run
* @param mins int minutes run
* @param secs int seconds run
* @param mind int (1-5) higher, better mood
* @param tiredness (1-5) higher, more tired
*/
public Run(double dist, int mins, int secs, int mind, int tiredness){
tMin = mins;
tSec = secs;
distance = dist;
mood = mind;
exhaustion = tiredness;
}
/**
* This method converts the mins and secs (passed in
* as integers) into a single doubleand returns the value
* @return double of comboTime
*/
public String getComboTime() {
double secondsFrac = tSec/60.0;
return format.format(tMin + secondsFrac);
}
/**
* This method returns the pace of the run mins/mi
* @return double pace of the run
*/
public String getPace(){
pace = format.format(((tSec/60.0) + tMin)/distance);
return pace;
}
/**
* This method returns the number of minutes run
* @return int minutes run
*/
public int getMin(){
return tMin;
}
/**
* This method returns the distance run
* @return double distance run
*/
public double getDistance(){
return distance;
}
/**
* This method returns the number of seconds run
* @return int seconds run
*/
public int getSec(){
return tSec;
}
/**
* This method returns the overall mood on the day run
* @return int mood level
*/
public int getMood(){
return mood;
}
public int getExhaustion(){
return exhaustion;
}
public String getDate(){
return date;
}
}