I am working on the following Java application

Write a program that allows the user to enter the last names of five candidates in a local election and the votes received by each candidate. The program should then output each candidate’s name, the votes received by that candidate, and the percentage of the total votes received by the candidate. Your program should also output the winner of the election. A sample output is:

Candidate Votes Received % of Total Votes
Johnson 5000 25.91
Miller 4000 20.72
Duffy 6000 31.09
Robinson 2500 12.95
Anthony 1800 9.33
Total 19300

The Winner of the Election is Duffy.

import java.util.*;
import java.text.NumberFormat;

public class Election


public static void main(String[] args)
String[] names = {args[0],args[2],args[4],args[6],args[8]};

int[] votes = {(integer.getInteger(args[1]).intValue()),(integer.getInteger(args[3]).intValue()),
(integer.getInteger(args[5]).intValue()), (integer.getInteger(args[7]).intValue()),

String winner = "";
int winnerVotes = 0;
int totalVotes = 0;

for(int j = 0; j < votes.length; j++);
totalVotes += votes[j];

NumberFormat formatter = NumberFormat.getNumberInstance();

System.out.println("\nCandidate Votes Received % of Total Votes");
System.out.println("--------- --------------- ---------------");

for(int j = 0; j<names.length; j++)
if (votes[j] > winnerVotes)
winner = names[j];
winnerVotes = votes[j];

                  names[j] + "\t\t"
          + (int)votes[j] + "\t\t"
                  + (formatter.format(
                  ( (double)votes[j] / totalVotes )*100)));

System.out.println("Total " + totalVotes);
System.out.println("The winner of the election is " + winner);

And what is your question?
From a first look it seams that the program works OK.
Are you having any problems or the results you receive are not correct?
I would suggest adding some checks for the inputs:

if (args.length<10) {
System.out.println("Not enough arguments");

or code for checking if the votes given are positive numbers

This article has been dead for over six months. Start a new discussion instead.