huge program, and I'm stuck and its frustrating me so
right OK, it doesn't like the String winner = (whatever) bits at the bottom and I don't know why, please can anybody help me... PLEASE!!
import java.util.*;
class MyProblem
{
public static void main ( String [] args)
{
int [] theNums = new int [5];
Scanner kybd = new Scanner(System.in);
for (int I = 0; I < 5 ; ++i)
{
System.out.print("Enter your vote:");
System.out.print("press 0 for 'candidate 1', 1 for 'candidate 2',");
System.out.print(" 2 for 'candidate 3', 3 for 'candidate 4'and 4 for 'candidate 5' ");
theNums[i] = kybd.nextInt();
}
int can0=0;
int can1=0;
int can2=0;
int can3=0;
int can4=0;
for (int I = 0; I < 5 ; ++i)
{
if (theNums[i] == 0)
{
can0 += 1;
}
if (theNums[i]== 1)
{
can1 += 1;
}
if (theNums[i] == 2)
{
can2 += 1;
}
if (theNums[i] == 3)
{
can3 += 1;
}
if (theNums[i]== 4)
{
can4 += 1;
}
//if (theNums[i]==-1)
//{
//end;
//}
}
if ((can0>can1)&&(can0>can2)&&(can0>can3)&&(can0>can4 ))
{
String winner = candidate1;
}
else if ((can1>can2)&&(can1>can3)&&(can1>can4))
{
String winner = candidate2;
}
else if ((can2>can3)&&(can2>can4))
{
String winner = candidate3;
}
else if (can3>can4)
{
String winner = candidate4;
}
else
{
String winner = candidate5;
}
System.out.println("winner is choice" + winner);
}
}