DEV TP01
This commit is contained in:
30
DEV/DEV3.1/TP01/Exercise1/Votes.java
Normal file
30
DEV/DEV3.1/TP01/Exercise1/Votes.java
Normal file
@@ -0,0 +1,30 @@
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Votes {
|
||||
|
||||
private String competitor;
|
||||
private ArrayList<Vote> voters;
|
||||
|
||||
public Votes(String competitor, ArrayList<Vote> voters) {
|
||||
this.competitor = competitor;
|
||||
this.voters = voters;
|
||||
}
|
||||
|
||||
public String getCompetitorName() {
|
||||
return this.competitor;
|
||||
}
|
||||
|
||||
public ArrayList<Vote> getVoters() {
|
||||
return this.voters;
|
||||
}
|
||||
|
||||
public int getTotalPoints() {
|
||||
int sum = 0;
|
||||
|
||||
for(Vote vote : this.voters) {
|
||||
sum += vote.getPoints();
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user