Question
To combat election fraud, your city is instituting a new voting procedure. The ballot has a letter associated with every selection a voter may make.
To combat election fraud, your city is instituting a new voting procedure. The ballot has a letter associated with every selection a voter may make. A sample ballot is shown:-
(Voter places a tick next to his or her preferred candidate, proposition and measure to indicate his/her vote)
1. Mayoral Candidates
A. Pincher, Penny
B. Dover, Skip
C. Perman, Sue
2. PROP 17
D. YES
E. NO
3. MEASURE 1
F. YES
G. NO
4. MEASURE 2
H. YES
I NO
After submitting the ballot, every voter receives a receipt that has a unique ID number and a record of the voting selections. For example, a voter who submits a vote for Sue, Perman, Yes on Proposition 17, No on Measure 1 and Yes on Measure 2 might receive a receipt with:-
ID 4925 : CDGH
The next day, the city posts all votes on its web page sorted by ID Number. This allows a voter to confirm their submission and allows anyone to count the vote totals for themselves. A sample list of for the sample ballot is shown below:-
ID VOTES 4925 CDGH 4926 AEGH 4927 CDGI 4928 BEGI 4929 ADFH Construct a C++ program that reads the posted voting list from a file named Vote.txtand outputs the percent of votes cast for each ballot item. File contains a list of Id numbers and a string containing votes (column B from the table).
Task:-
Define a class named Nofraud that stores an individuals voting record. The class should have a constructor that takes as input a string of votes for example "CDGH", a voter Id, an accessor function(s) that return the person's Id and vote for a specific question. Store each Voter instance in an array or vector.
Your program should iterate over the array to compute and output the percent of votes cast for each candidate, proposition and measure. It should then prompt the user to enter a voter Id, iterate over the list again to find the object with that ID and print his or her votes.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started