import java.util.*;
public class Election
{
static Scanner console = new Scanner(System.in);
public static void main(String[] args)
{
for (int i = 0; i < 5; i++)
{
System.out.print("Please enter the candidates last name: ");
name = console.next();
System.out.print("Please enter the candidates total votes: ");
vote = console.nextInt();
inputC(name, vote);
}
public static void inputC(String a, int b)
{
String name = a;
int vote = b;
String[] names = new String[5];
int[] votes = new int[5];
for (int i = 0; i < names.length; i++)
{
//System.out.print("Please enter the candidates last names: ");
//name = console.next();
names = name;
}
for (int d = 0; d < votes.length; d++)
{
//System.out.print("Please enter the candidates total votes: ");
//vote = console.nextInt();
votes[d] = vote;
}
}
public static void percent(int[] v1)
{
double[] percent = new double[5];
int sum;
double percents;
for (int i = 0; i < v1.length; i++)
sum = sum + v1;
for (int i = 0; i < v1.length; i ++)
for (int d = 0; d < percent.length; d++)
{
percents = (v1/sum);
percent[d] = percents;
}
}
}
Need some help in JAVA please!
Hey i'm creating a program right now...its not all the way done but i'm encountering an error. I know it has to be something simple but im just having problems haha
the code is:
and the error im getting is:
Election.java:24: illegal start of expression
public static void inputC(String a, int b)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement