The voting results from the student body representative race has been reported by each faculty as tabled below : Candidate A 192 Candidate B Candidate C Candidate D Faculty 1 Faculty 2 Faculty 3 Faculty 4 Faculty 5 48 90 206 312 37 21 147 186 12 121 38 114 267 21 13 408 382 39 29 Write a program to do the following: a. Display the table with appropriate labels for rows and columns Create function to do this : void printArray(int arr[]) b. Compute and display the total number of votes received by each candidate and the percentage of the total votes casts Store total number of votes received by each candidate in an array: int candidateVotes[]; Store percentage of votes received in another array: double candidateVotesPercent[]; c. (1) If any one candidate received 50% of the votes, the program should display a message decdaring that the candidate is the winner. (i)If no candidate received 50% of the votes, the program should display a message showing the top 2 candidates with the most number of votes. Create a function to perform the announcement of winners based on votes percentage: void announceWinner(double candidatesVotesPercent[]) d. Run the program with the data shown above and run once more using the data below |Candidate A 192 Candidate B 48 Candidate C 206 |Candidate D 37 Faculty 1 Faculty 2 Faculty 3 Faculty 4 Faculty 5 147 90 312 21 186 114 12 21 121 108 38 39 267 13 382 29

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%
The voting results from the student body representative race has been reported by each faculty
as tabled below :
Candidate A
Candidate B
Candidate C
Candidate D
Faculty 1
Faculty 2
Faculty 3
Faculty 4
Faculty 5
192
48
206
37
21
38
147
90
312
186
12
121
114
267
408
382
39
29
21
13
Write a program to do the following:
a. Display the table with appropriate labels for rows and columns
Create function to do this :
void printArray(int arr[])
b. Compute and display the total number of votes received by each candidate and the
percentage of the total votes casts
Store total number of votes received by each candidate in an array:
int candidateVotes[];
Store percentage of votes received in another array:
double candidateVotesPercent[];
c. (1) If any one candidate received 50% of the votes, the program should display a
message declaring that the candidate is the winner.
(i)If no candidate received 50% of the votes, the program should display a message
showing the top 2 candidates with the most number of votes.
Create a function to perform the announcement of winners based on votes percentage:
void announceWinner(double candidatesVotesPercent[])
d. Run the program with the data shown above and run once more using the data below
Candidate A
192
Candidate B
48
Candidate C
206
Candidate D
37
Faculty 1
Faculty 2
Faculty 3
Faculty 4
Faculty 5
147
90
312
21
12
21
121
38
39
186
114
108
382
267
13
29
Transcribed Image Text:The voting results from the student body representative race has been reported by each faculty as tabled below : Candidate A Candidate B Candidate C Candidate D Faculty 1 Faculty 2 Faculty 3 Faculty 4 Faculty 5 192 48 206 37 21 38 147 90 312 186 12 121 114 267 408 382 39 29 21 13 Write a program to do the following: a. Display the table with appropriate labels for rows and columns Create function to do this : void printArray(int arr[]) b. Compute and display the total number of votes received by each candidate and the percentage of the total votes casts Store total number of votes received by each candidate in an array: int candidateVotes[]; Store percentage of votes received in another array: double candidateVotesPercent[]; c. (1) If any one candidate received 50% of the votes, the program should display a message declaring that the candidate is the winner. (i)If no candidate received 50% of the votes, the program should display a message showing the top 2 candidates with the most number of votes. Create a function to perform the announcement of winners based on votes percentage: void announceWinner(double candidatesVotesPercent[]) d. Run the program with the data shown above and run once more using the data below Candidate A 192 Candidate B 48 Candidate C 206 Candidate D 37 Faculty 1 Faculty 2 Faculty 3 Faculty 4 Faculty 5 147 90 312 21 12 21 121 38 39 186 114 108 382 267 13 29
Sample Output:
CandidateA
CandidateB
CandidateC
CandidateD
Facultyl
Faculty2
Faculty3
Faculty4
Faculty5
Total Votes : 2683
192
48
206
37
147
90
312
21
186
12
121
38
114
21
408
39
267
13
382
29
Candidate Votes: 906
Candidate Votes %:33.77
184
1429
164
6.86
53.26
6.11
Candidate C wins!
CandidateA
CandidateB
Candidatec
CandidateD
Facultyl
Faculty2
Faculty3
Faculty4
Faculty5
Total Votes : 2383
192
48
206
37
147
90
312
21
186
12
121
38
114
21
108
39
267
13
382
29
Candidate Votes: 906
Candidate Votes %:38.02
184
1129
164
7.72
47.38
6.88
No candidates got more than 50% votes.
There are 2 candidates with high votes
2 highest vote : Candidate C and Candidate A
Transcribed Image Text:Sample Output: CandidateA CandidateB CandidateC CandidateD Facultyl Faculty2 Faculty3 Faculty4 Faculty5 Total Votes : 2683 192 48 206 37 147 90 312 21 186 12 121 38 114 21 408 39 267 13 382 29 Candidate Votes: 906 Candidate Votes %:33.77 184 1429 164 6.86 53.26 6.11 Candidate C wins! CandidateA CandidateB Candidatec CandidateD Facultyl Faculty2 Faculty3 Faculty4 Faculty5 Total Votes : 2383 192 48 206 37 147 90 312 21 186 12 121 38 114 21 108 39 267 13 382 29 Candidate Votes: 906 Candidate Votes %:38.02 184 1129 164 7.72 47.38 6.88 No candidates got more than 50% votes. There are 2 candidates with high votes 2 highest vote : Candidate C and Candidate A
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
List
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education