Jump to content
  • Advertisement
Sign in to follow this  
l jsym l

Need some help in JAVA please!

This topic is 3300 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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:
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;
and the error im getting is: Election.java:24: illegal start of expression public static void inputC(String a, int b)

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!