Methods Summary |
---|
public int | getAnswer1()Returns the number of alternative 1 answers.
return answer1;
|
public int | getAnswer1Percent()Returns the percentage of alternative 1 answers.
return getPercent(total, answer1);
|
public int | getAnswer2()Returns the number of alternative 2 answers.
return answer2;
|
public int | getAnswer2Percent()Returns the percentage of alternative 2 answers.
return getPercent(total, answer2);
|
public int | getAnswer3()Returns the number of alternative 3 answers.
return answer3;
|
public int | getAnswer3Percent()Returns the percentage of alternative 3 answers.
return getPercent(total, answer3);
|
private int | getPercent(int total, int answer)Returns an int representing the rounded percentage of
answers.
return (int) Math.round(((double) answer / (double) total) * 100);
|
public int | getTotal()Returns the total number of answers.
return total;
|
public void | setAnswer(AnswerBean answer)Increments the counter matching the answer as well
as the total number of answers.
total++;
String answerId = answer.getAnswerId();
if (answerId.equals("1")) {
answer1++;
}
else if (answerId.equals("2")) {
answer2++;
}
else if (answerId.equals("3")) {
answer3++;
}
|