C++  Election Day Write a program that compiles the result of an election.  You will read the candidate last names from ballot.txt(also provided with the starter code).  The ballot can have up to 10 people on it. For each candidate, prompt the user for the total number of votes they got in the election. You should calculate the total votes cast and the % of the vote each candidate earned. Display to the console a report showing the candidate name, the number votes received, and the percent of the total vote. You should also display the total votes cast and the winner. INPUT VALIDATION: Make sure the votes cast is greater than or equal to 0, and that it is a number. Sample output:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

C++

 Election Day

Write a program that compiles the result of an election.  You will read the candidate last names from ballot.txt(also provided with the starter code).  The ballot can have up to 10 people on it. For each candidate, prompt the user for the total number of votes they got in the election. You should calculate the total votes cast and the % of the vote each candidate earned. Display to the console a report showing the candidate name, the number votes received, and the percent of the total vote. You should also display the total votes cast and the winner.

INPUT VALIDATION: Make sure the votes cast is greater than or equal to 0, and that it is a number.

Sample output:

**Election Results Data Entry and Validation**

In the election data entry process, the following votes were recorded for each candidate:

- **Stone**: 7012 votes
- **Hutchinson**: 8990 votes
- **Evans**: 4675 votes
- **Chase**: 5105 votes
- **Winters**: 3655 votes
- **Shaffer**: 5081 votes

The total number of votes cast was 34,518. Here's a breakdown of the percentage of total votes received by each candidate:

- **Shaffer**: 14.72%
- **Stone**: 20.31%
- **Hutchinson**: 26.04%
- **Evans**: 13.54%
- **Chase**: 14.79%
- **Winters**: 10.59%

The winner of the election is **Hutchinson**.

**Data Entry Validation**

During the data entry process, the system ensures that inputs are valid. Here are some scenarios:

- If a non-numeric character is entered for votes ("a"), the system prompts: "That is not a number! Please try again."
- Negative numbers are flagged: "The number of votes cannot be less than 0. Please try again."

Additional valid vote entries include:

- **Shaffer**: 234 votes
- **Stone**: 123 votes
- **Hutchinson**: 675 votes
- **Evans**: 134 votes
- **Chase**: 923 votes

This process ensures accurate data collection and validation for electoral purposes.
Transcribed Image Text:**Election Results Data Entry and Validation** In the election data entry process, the following votes were recorded for each candidate: - **Stone**: 7012 votes - **Hutchinson**: 8990 votes - **Evans**: 4675 votes - **Chase**: 5105 votes - **Winters**: 3655 votes - **Shaffer**: 5081 votes The total number of votes cast was 34,518. Here's a breakdown of the percentage of total votes received by each candidate: - **Shaffer**: 14.72% - **Stone**: 20.31% - **Hutchinson**: 26.04% - **Evans**: 13.54% - **Chase**: 14.79% - **Winters**: 10.59% The winner of the election is **Hutchinson**. **Data Entry Validation** During the data entry process, the system ensures that inputs are valid. Here are some scenarios: - If a non-numeric character is entered for votes ("a"), the system prompts: "That is not a number! Please try again." - Negative numbers are flagged: "The number of votes cannot be less than 0. Please try again." Additional valid vote entries include: - **Shaffer**: 234 votes - **Stone**: 123 votes - **Hutchinson**: 675 votes - **Evans**: 134 votes - **Chase**: 923 votes This process ensures accurate data collection and validation for electoral purposes.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Concept of memory addresses in pointers
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education