Problem

To combat election fraud, your city is instituting a new voting procedure. The ballot has...

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. 11.5

1. VOTE FOR MAYOR

 

A. Pincher, Penny

 

B. Dover, Skip

 

C. Perman, Sue

2.

PROPOSITION 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 ballot for Sue Perman, Yes on Proposition 17, No on Measure 1, and Yes on Measure 2 might receive a receipt with

ID 4925 : CDCH

The next day die 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 for the sample ballot is shown.

ID

VOTES

4925

CDGH

4926

AEG H

4927

CDGI

4928

BEGI

4929

ADFH

Write a program that reads the posted voting list from a file and outputs the percent of votes cast for each ballot item. You may assume that die file does not have any header lines. The first line will contain a voter ID and a string representing votes. Define a class named Voter that stores an individual’s voting record. The class should have a constructor that takes as input a string of votes (for example, “CDGH”), a voter ID, and 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

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 11
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT