The voting resuts trom he student bady representative race has been reportad by cach faculty as tabled below: Candidate Candidate Candidate C Candidate D 90 Wite a program to do the folloning: a Display the table wim appropriate labels for rows and columes Create function to do this: void printamaynt an(1) . Campute and display the total number of vates received by each canddate and the percentage of the tal votes casts Store total number of vates recved by cach candidate in an array: nt candidatevtesG Store percentage of votes recelved in ancther array: double candidatvuteercen c 0Fany ane candidate recelved So% of the votes, the program should daplay a message deciaring that the candidate is the winner. gar no candidate received S0% of the votes, the program shauld diplay a mesage Create a function to perform the announcement of winners based on votes percentage void announceinner(doutle candidatevotesercentD

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Pratice 1
The voting results from the student body representative race has been reported by each faculty
as tabled below:
Candidate B
48
Candidate C
206
Candidate D
37
21
Candidate A
Faculty
Faculty 2
Faculty 3
Faculty 4
Faculty 5
192
147
90
312
186
114
12
121
38
21
13
408
382
39
267
29
Write a program to do the following:
a. Display the table with appropriate labels for rows and columns
Create function to do this :
vold printarray(int ant])
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 vates received by each candidate in an array:
int candidatevotes():
Store percentage of votes received in another array:
double candidatevotesPercent():
C () Ir any one candidate received 50% of the votes, the program should display a
message declaring that the candidate is the winner.
Qjar 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:
vold announceWinner(double candidatesVotesPercent()
d. Run the program with the data shown above and run once more using the data below
Candidate A
Candidate B
Candidate C
Candidate D
Faculty 1
Faculty 2
Faquly 3
192
48
206
37
147
90
312
21
186
12
121
38
Faculty 4
Faculty 5
108
382
114
21
39
267
13
29
Sample Output:
CandidateA
Candidatel
Candidate
CandidateD
Faculty1
Faculty2
Faculty3
Faculty4
Faculty5
Total Votes : 2683
192
48
206
37
147
90
312
21
186
12
121
114
21
408
39
267
13
382
29
Candidate Votes: se6
Candidate Votes :33.77
184
1429
164
6.86
53.26
6.11
Candidate C uins!
Candidatea
CandidateB
Candidatec
Candidateb
Faculty1
Facultyz
Faculty3
Faculty4
Facultys
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:Pratice 1 The voting results from the student body representative race has been reported by each faculty as tabled below: Candidate B 48 Candidate C 206 Candidate D 37 21 Candidate A Faculty Faculty 2 Faculty 3 Faculty 4 Faculty 5 192 147 90 312 186 114 12 121 38 21 13 408 382 39 267 29 Write a program to do the following: a. Display the table with appropriate labels for rows and columns Create function to do this : vold printarray(int ant]) 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 vates received by each candidate in an array: int candidatevotes(): Store percentage of votes received in another array: double candidatevotesPercent(): C () Ir any one candidate received 50% of the votes, the program should display a message declaring that the candidate is the winner. Qjar 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: vold announceWinner(double candidatesVotesPercent() d. Run the program with the data shown above and run once more using the data below Candidate A Candidate B Candidate C Candidate D Faculty 1 Faculty 2 Faquly 3 192 48 206 37 147 90 312 21 186 12 121 38 Faculty 4 Faculty 5 108 382 114 21 39 267 13 29 Sample Output: CandidateA Candidatel Candidate CandidateD Faculty1 Faculty2 Faculty3 Faculty4 Faculty5 Total Votes : 2683 192 48 206 37 147 90 312 21 186 12 121 114 21 408 39 267 13 382 29 Candidate Votes: se6 Candidate Votes :33.77 184 1429 164 6.86 53.26 6.11 Candidate C uins! Candidatea CandidateB Candidatec Candidateb Faculty1 Facultyz Faculty3 Faculty4 Facultys 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 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY