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 147 90 312 21 186 12 121 38 114 21 408 39 267 13 382 29 Uce C codo:

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter12: Database Queries With Sql
Section: Chapter Questions
Problem 1E
icon
Related questions
Question

use C code

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
147
06
312
21
186
12
121
38
39
114
267
21
408
13
382
29
use C code:
Display the table with appropriate labels for rows and columns
Create function to do this :
void printArray(int arr[])
Dsplay 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[];
If any one candidate received 50% of the votes, the program should display a
message declaring that the candidate is the winner. 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[])
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
Faculty 3
Faculty 4
Faculty 5
192
48
206
37
147
90
312
21
186
12
121
38
114
21
108
39
267
13
382
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 147 06 312 21 186 12 121 38 39 114 267 21 408 13 382 29 use C code: Display the table with appropriate labels for rows and columns Create function to do this : void printArray(int arr[]) Dsplay 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[]; If any one candidate received 50% of the votes, the program should display a message declaring that the candidate is the winner. 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[]) 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 Faculty 3 Faculty 4 Faculty 5 192 48 206 37 147 90 312 21 186 12 121 38 114 21 108 39 267 13 382 29
CandidateA
CandidateB
CandidateC
CandidateD
Faculty1
Faculty2
Faculty3
Faculty4
Faculty5
Total Votes : 2683
192
48
206
37
147
90
312
121
21
186
12
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
Faculty1
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
After you have successfully created the program above, modify part(b) of your program,
Create 2 functions:
One will return an array of total votes for each candidate
int * candidateVotes (int votes[][])
i.
One will return an array of total percentage of votes for each candidate
double * candidateVotes (int votes[][])
Transcribed Image Text:CandidateA CandidateB CandidateC CandidateD Faculty1 Faculty2 Faculty3 Faculty4 Faculty5 Total Votes : 2683 192 48 206 37 147 90 312 121 21 186 12 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 Faculty1 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 After you have successfully created the program above, modify part(b) of your program, Create 2 functions: One will return an array of total votes for each candidate int * candidateVotes (int votes[][]) i. One will return an array of total percentage of votes for each candidate double * candidateVotes (int votes[][])
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
ASCII Codes
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
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr