Question: Write a program in JAVA that prompts for an integer N, and allows the user to enter the last names of N candidates in a
Write a program in JAVA that prompts for an integer N, and allows the user to enter the last names of N candidates in a local election and the number of votes received by each candidate. The program then outputs each candidates name, the number of votes received, and the percentage of the total votes received by the candidate. The program also outputs the winner of the election.
(1) Prompt the user to input N candidates and the number of votes, then display the inputs
Enter an integer: You entered: 4 Enter 4 names and numbers: You entered: King 5000 Harris 3500 Jones 6000 Duffy 1900
Calculate the total votes received and percentage of received by each candidate
Candidate Votes Received % of Total Votes King 5000 30.49 Harris 3500 21.34 Jones 6000 36.59 Duffy 1900 11.59 Total 16400
Fine the Winner
The Winner is Jones.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
