@Test public void testAverage() { Voting voting = createVoting(); Assert.assertEquals(1.5, voting.getAverage(), 0.001); }
@XmlElement public double getAverage() { int sum = 0; for (Vote vote : votes) { sum += vote.getVote(); } return new Double(sum) / votes.size(); }
Voting { @XmlElement public double getAverage() { int sum = 0; for (Vote vote : votes) { sum += vote.getVote(); } return new Double(sum) / votes.size(); } }
Voting { @XmlElement public double getAverage() { int sum = 0; for (Vote vote : votes) { sum += vote.getVote(); } return new Double(sum) / votes.size(); } Voting();  Voting(String topic); }
Voting { @XmlElement public double getAverage() { int sum = 0; for (Vote vote : votes) { sum += vote.getVote(); } return new Double(sum) / votes.size(); } Voting();  Voting(String topic); @XmlElement double getAverage(); String getTopic(); void setTopic(String topic); @XmlElement(name="vote") List<Vote> getVotes(); void addVote(Vote vote); String getStats(); }
Voting { @XmlElement public double getAverage() { int sum = 0; for (Vote vote : votes) { sum += vote.getVote(); } return new Double(sum) / votes.size(); } Voting();  Voting(String topic); @XmlElement double getAverage(); String getTopic(); void setTopic(String topic); @XmlElement(name="vote") List<Vote> getVotes(); void addVote(Vote vote); String getStats();  }