Class Voting
java.lang.Object
Voting
public class Voting
extends java.lang.Object
this class give info about a voting
-
Constructor Summary
Constructors Constructor Description Voting(int type, java.lang.String question, java.util.ArrayList<java.lang.String> choices)
creat a new voting -
Method Summary
Modifier and Type Method Description void
createChoice(java.lang.String choice)
add a new option to votingjava.util.ArrayList<java.lang.String>
getChoices()
get the option listjava.lang.String
getQuestion()
get the questionint
getType()
this method return type of votingvoid
getVoters()
this method goes through voters and print a list of themvoid
printVotes()
void
vote(Person person, java.util.ArrayList<java.lang.String> choices)
add a new vote to voting by given person and choices
-
Constructor Details
-
Voting
public Voting(int type, java.lang.String question, java.util.ArrayList<java.lang.String> choices)creat a new voting- Parameters:
type
- of votingquestion
- question of votingchoices
- list of options
-
-
Method Details
-
getType
public int getType()this method return type of voting- Returns:
- type
-
getChoices
public java.util.ArrayList<java.lang.String> getChoices()get the option list- Returns:
- choices
-
getQuestion
public java.lang.String getQuestion()get the question- Returns:
- question
-
createChoice
public void createChoice(java.lang.String choice)add a new option to voting- Parameters:
choice
- we want to add
-
vote
add a new vote to voting by given person and choices- Parameters:
person
- who votedchoices
- were voted
-
getVoters
public void getVoters()this method goes through voters and print a list of them -
printVotes
public void printVotes()
-