Problem Solving with C++ (10th Edition)
Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 11, Problem 12PP

Solution to Programming Project 11.12

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.

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 : 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 for the sample ballot is shown.

4925 CDGH
4926 AEGH
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 the 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.

Blurred answer
Students have asked these similar questions
python programming.
java - NetBeans
In this lab work, you will implement a coffee shop example. In this coffee shop, everything must progress as if it does in real life. It means that the program should ask a person for body temperature in Celsius, and grant or reject access to a coffee shop. When a customer orders a coffee, they have to choose a size such as Small, Medium, and Large then, depending on the order, the price has to change. The price also has to change depending on the type of coffee. For example, for coffees that are similar to espresso, you also need to take every shot of espresso into account. The actual prices of the coffees depend on your imagination however, they should be realistic. Some hints: • Focus on dividing your program into multiple functions. • You can also return double or integer types of values from your functions, so use them if you can. • Don't just code a function every possible type of, and try to make it generic as much as possible. • Be creative. Fill the gaps using your…

Chapter 11 Solutions

Problem Solving with C++ (10th Edition)

Ch. 11.1 - Given the following definitions: const int x = 17;...Ch. 11.2 - What is the difference between a (binary) operator...Ch. 11.2 - Prob. 13STECh. 11.2 - Suppose you wish to overload the operator = so...Ch. 11.2 - Prob. 15STECh. 11.2 - Give the definition for the constructor discussed...Ch. 11.2 - Here is a definition of a class called Pairs....Ch. 11.2 - Following is the definition for a class called...Ch. 11.3 - Give a type definition for a structure called...Ch. 11.3 - Write a program that reads in five amounts of...Ch. 11.3 - Change the class TemperatureList given in Display...Ch. 11.3 - Prob. 22STECh. 11.3 - If a class is named MyClass and it has a...Ch. 11.4 - Prob. 24STECh. 11.4 - The following is the first line of the copy...Ch. 11.4 - Answer these questions about destructors. a. What...Ch. 11.4 - a. Explain carefully why no overloaded assignment...Ch. 11 - Modify the definition of the class Money shown in...Ch. 11 - Self-Test Exercise 17 asked you to overload the...Ch. 11 - Self-Test Exercise 18 asked you to overload the...Ch. 11 - Prob. 1PPCh. 11 - Define a class for rational numbers. A rational...Ch. 11 - Define a class for complex numbers. A complex...Ch. 11 - Enhance the definition of the class StringVar...Ch. 11 - Define a class called List that can hold a list of...Ch. 11 - Define a class called StringSet that will be used...Ch. 11 - This programming project requires you to complete...Ch. 11 - Redo Programming Project 6 from Chapter 9 (or do...Ch. 11 - Solution to Programming Project 11.12 To combat...Ch. 11 - Repeat Programming Project 11 from Chapter 10 but...Ch. 11 - Do Programming Project 19 from Chapter 8 except...

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
If N is an integer power of the power of 2, is N / 2 same as N 1?

Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)

Distance File Modify the program you wrote for Programming Challenge 2 (Distance Traveled) so it writes the rep...

Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)

(Continuously compounded interest) Suppose that you discover in your attic an overdue library book on which you...

Differential Equations: Computing and Modeling (5th Edition), Edwards, Penney & Calvis

Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY