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.<< so far my program can do this<<
if the user enters a last name in small letters the program should display the surname with the first character in capitals <<< im really not sure how to do this on this program,please help<<<..
this is the code so far:
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()),
(integer.getInteger(args[9]).intValue())};
String winner = "";
int winnerVotes = 0;
int totalVotes = 0;
for(int j = 0; j < votes.length; j++);
{
totalVotes += votes[j];
}
NumberFormat formatter = NumberFormat.getNumberInstance();
formatter.setMinimumIntegerDigits(1);
formatter.setMaximumFractionDigits(2);
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];
}
System.out.println(
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);
}
}