-
Notifications
You must be signed in to change notification settings - Fork 0
/
DogTriathlonParticipant.java
40 lines (36 loc) · 1.14 KB
/
DogTriathlonParticipant.java
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
public class DogTriathlonParticipant
{
private final int NUM_EVENTS;
private int totalCumulativeScore = 0;
private String name;
private int obedienceScore;
private int conformationScore;
private int agilityScore;
private int total;
private double avg;
public DogTriathlonParticipant(String name,
int numEvents, int score1, int score2, int score3)
{
this.name = name;
NUM_EVENTS = numEvents;
obedienceScore = score1;
conformationScore = score2;
agilityScore = score3;
total = obedienceScore +
conformationScore + agilityScore;
avg = (double) total / NUM_EVENTS;
totalCumulativeScore = totalCumulativeScore+
total;
}
public void display()
{
//NUM_EVENTS = 5;
System.out.println(name + " \nParticipated in " +
NUM_EVENTS +
" events and has an average score of " + avg);
System.out.println(" " + name +
"has a total score of " + total +
" bringing the total cumulative score to " +
totalCumulativeScore);
}
}