The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 6 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
The voting district in which you live is partitioned into five precincts. Write a program that reads the election results from each of these precincts and tabulates the total vote in your district for all of the candidates running for election. The program should begin by asking the user to enter the number of candidates, nmbrCandidates, running for office. It should then read the election returns for each precinct for each candidate, compute the total vote for each candidate, and display the input and the results in the form shown in the table.
For each candidate, the program should also compute and display the percentage of the total vote. If there is one candidate whose percentage is better than 50 percent, display a message declaring that candidate to be the winner of the election. If there is no such candidate, display out a message indicating the names of the top two vote-getters and indicate that a run-off election will be required. The voting data should be stored in an indexed collection of structured elements, each of which contains the name of a candidate, the number of votes in each precinct for that candidate, and the total vote. The relevant information about each candidate should be modeled by a class containing the definitions of the necessary attributes and functions required for one candidate.
Test your program for the data shown below and also when candidate C receives only 108 votes in precinct 4.

Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â----------- -----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------sol-----------uti-----------on.-----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- ca-----------tch-----------