Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Programming Language Write a program that prompts for an integer N, and allows the user to enter the last names of N candidates in

JAVA Programming Language

Write a program 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 4 candidates and the number of votes, then display the inputs (3 points).

Enter an integer: You entered: 4 Enter 4 names and numbers: You entered: King 5000 Harris 3500 Jones 6000 Duffy 1900 

(2) Calculate the total votes received and percentage of received by each candidate (4 pts)

Candidate Votes Received % of Total Votes King 5000 30.49 Harris 3500 21.34 Jones 6000 36.59 Duffy 1900 11.59 Total 16400 

(3) Fine the Winner (3 pts)

The Winner is Jones.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions