Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Election Results using array (JAVA) The results from the mayor's race have been reported by each precinct as follows: Candidate Candidate Candidate Candidate Winner Runoff

Election Results using array (JAVA)

The results from the mayor's race have been reported by each precinct as follows: Candidate Candidate Candidate Candidate Winner Runoff Precinct A B C D 1 192 48 206 37 2 147 90 312 21 3 186 12 121 38 4 114 21 408 39 5 267 13 382 29

Write a program using a two-dimensional array to do the following: a. Read the raw vote totals from a data file that contains one row for each precinct. b. Display the table with appropriate headings for the rows and columns. c. Compute and display the total number of votes received by each candidate and the percent of the total votes cast. d. If any one candidate received over 50% of the votes, the program should print, in the last column, a message declaring that candidate the winner. f. For testing, run the program with the above data, and also with another data file where Candidate C receives only 108 votes in precinct 4.

Data file:

(precinct, candiadateAvotes, , candiadateBvotes, candiadateCvotes, candiadateDvotes

1,192,48,206,37 2,147 90,312,21 3,186,12,121,38 4,114,21,408,39 5,267,13,382,29

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

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

What is Ramayana, who is its creator, why was Ramayana written?

Answered: 1 week ago

Question

To solve by the graphical methods 2x +3y = 9 9x - 8y = 10

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago