Reputation: 3
I am currently making a voting system where the voter enters in their details such as name, age etc. I also have another class for admin, the admin can view the list of results but i also want the admin to edit the voter details and to save the edit. this is what i have so far:
public void EditVoterAccounts()
{
int i=0;
for (Voters vote: Voters.listVoters)
{
System.out.println(i + " " + vote.getName());
}
}
Also another problem is the list of the voters come up as all 0. For example, it should show up like this:
0 voter
1 second voter
3 third.
but what I am getting is this:
0 voter
0 second voter
0 third
which I am guessing will confuse the system
Upvotes: 0
Views: 1008
Reputation: 368
You've forgotten to increment the counter.
public void EditVoterAccounts()
{
int i = 0;
for (Voters vote: Voters.listVoters)
{
System.out.println(i + " " + vote.getName());
i++;
}
}
Upvotes: 1