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:

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:

Expand

Expert Answer

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Science

Object Oriented Programming

Programing Language

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: Question 1: pertains to the Cherokee School District scenario below. The school board for the Cherok...

A: mixed-integer programming (MIP) problem is one where some of the decision variables are constrained ...

Q: Describe a recent security breach involving access control or authentication that has been reported ...

A: Security beach: Security breach refers to an unauthorized access to the data to misuse it for your ...

Q: Write a method called deleteMultipleNodes to be included in the class KWLinkedList (class for doubly...

A: Note: head represent Head of List and tail represent Tail of list void deleteMultipleNodes (int coun...

Q: Why an I getting this message in PHP? prepare($query); $stmt->bindValue(':firstname', $firstname)...

A: Solution: To encrypt the password you need to create a new variable $hashedPassword which you will s...

Q: How does this method cause memory leaks? How do I make it multi-thread safe? I have this JUnit test ...

A: public class BaseTest{    @Autowired    protected SessionFactory sessionFactory;    protected Sessio...

Q: How do you write a java programme  that prompts the user to input two integer values and outputs the...

A: Joptionpane is used to display information or get input from the user. It provide standard dialog bo...

Q: List down cloud computing resources and describe how businesses use cloud computing to manage resour...

A: It is defining as a distributed network for the sharing and running of program or application over m...

Q: Database please answer the questions(image)

A: Click to see the answer

Q: Can someone help with this ?Create a Java program that uses a loop for • Reads from the console the ...

A: public class Main {  //Main Function  public static void main(String[] args) {  //Creating the objec...

Q: The Code must be in Java   Write a program to calculate the following for each integer from 0 to 35:...

A: Actually, program is a executable software that runs on a computer.

Q: Q.6.1 Briefly explain what a method is and describe the three main parts of amethod

A: Method Once you have created objects, you want them to be able to do something. This is where method...

Q: C + +   Project Description   The Lo Shu Magic Square The Lo Shu Magic Square is a grid with 3 rows ...

A: #include<iostream>#include <algorithm>using namespace std;// Global constantsconst int R...

Q: Given a 512 x 512 image, calculate the number of bytes required for its pixel storage for a) A grey ...

A: A) In a 512 * 512 image with 256 gray level (lie 128 bits/pixel)   512 * 512 * 128 = 33 ,554,432 bit...

Q: Answer the following question using Python

A: Please find the answer below :

Q: Write a complete Java program that prompts the user to input two integer values and outputs thelarge...

A: import javax.swing.*; public class Tester{ public static void main(String[] args) {    JFrame f=new ...

Q: Data Structure and algorithms   ( in Java ) Please solve it urgent basis: Make a programe in Java wi...

A: Note: - As per the guidelines we can only answer one specific question at a time. Please resubmit th...

Q: In C# develop a GUI for a very basic banking system that does different features, as follows: First,...

A: ⦁ Created class with name Bank, where we have following member functions. ⦁ openAccount() it will op...

Q: Find the attached file.

A: Class defitnion:  Class is a user-defined data type that contains the data members and member functi...

Q: What would happen when the following code is run and why? int num[] = {2, 4, 6, 8}; System.out.print...

A: An array in Java is a group of variables of the same type. An array is a reference type variable, bu...

Q: Note:- Study this program and follow the given instruction and type execute the code and also give o...

A: Actually, java is a object oriented programming language. It is a platform independent.

Q: 1. Construct a class Assessment with the following attributes a. Id (int) b. Topic(String) c. MaxMar...

A: import java.util.*; public class Main{ public static void main(String[] args){          //create an ...

Q: Discuss the potential risks of data at rest and data in transit, giving examples of what you think c...

A: Solution : (1st part ) Data is at rest: So when we are talking about the data at rest so the data is...

Q: Task 2: abstract Class: TwoDimensionShape Create an abstract class called "TwoDimensionShape", which...

A: Objective: An abstract class TwoDimensionalShape would be developed implementing the interface "Shap...

Q: Computer Science Question

A: file = open("data.txt", "w+") while True:    name = input("Enter employee name or Enter to quit ")  ...

Q: Problem 98 Write a query to display the book number, title, and number of times each book has been c...

A: SELECT CHECKOUT.Book_Num, Book_Title, COUNT(*) 'Times Checked Out' FROM BOOK LEFT JOIN CHECKOUT ON B...

Q: Write a static method called larger that accepts two double parameters and returns the larger of the...

A: In function definition, to find the larger of two values we need to use if-else statement. The requi...

Q: Use Python

A: Program Approach: Define modify_string function and pass input_string as parameter . Define letters...

Q: What is the Hypotheses of cyber crime ?? Operation HypothesisNull Hypothesis Answer this question wi...

A: The  cyber crime hypothesis remains a matter of substitution – such that  as offenders expend their ...

Q: 1 Insert the following customer into the CUST_MYSQL table, allowing the AUTO_INCREMENT attribute set...

A: insert into CUSTOMER(CUST_LNAME, CUST_FNAME, CUST_BALANCE)values('Powers', 'Ruth', 500);

Q: 36.  Which of the following features within a DBMS is not provided to maintain database integrity?A....

A: Explanation of all the above-given options:   a) Concurrent transaction processing: In the concurre...

Q: In Python When analyzing data sets, such as data for human heights or for human weights, a common st...

A: Actually, python is a easiest programming language. It is a dynamically typed programming language. ...

Q: JAVA assignment: Exercise 1: Implement the class Student as presented by the following UML diagram: ...

A: public class Student { private String name; private int id; private char gender; private String addr...

Q: Which of the following is false? A) Problems that cannot be solved using loops can be solved with re...

A: Answer in step2

Q: Consider the Speaker interface shown below: public interface Speaker{    public void speak();} For t...

A: GIVEN: Create a Java program with 2 classes Human and Dog, both will implement the Speaker interface...

Q: Let's say you have an integer array and a string array. You have to write a single method printArray...

A: Please find the answer below :  

Q: Which of the following can NOT be stored in an array?     The months of the year     Sca...

A: Array: This data structure is used to store similar types of data. It consists of contiguous memory...

Q: translate into Pep/9 assembly language code: #include <iostream>using namespace std;const numL...

A: main:         push    rbp         mov     rbp, rsp         sub     rsp, 16         mov     DWORD PTR...

Q: Write a class Person that has attributes of id, name and address. It has a constructor to initialize...

A: ⦁ Created class Person, which is a base class with the attributes id_p, name and address. ⦁ Using fu...

Q: Create a program that takes in two words, check for equality ignoring the cases, if the words are eq...

A: Actually, python is a easiest programming language. It is a dynamically typed programming language.

Q: What is visual basic?

A: Visual Basic (VB) is an occasion driven programming language and climate from Microsoft that gives a...

Q: Question#3.Write a Python program to reverse a stack using recursion. Problem Solution Hints: 1. Cre...

A: Step 1:- Program Approach:-   1.Declare the Class stack 2.Declare user-defined function/method 3.Use...

Q: BR MAIN FORMAT Complete the following C++ programs into Pep/9 assembly language: 1) int main(){  int...

A: 1) Answer  __gthread_key_delete(int):        str     fp, [sp, #-4]!        add     fp, sp, #0       ...

Q: In an array-based implementation of a List, why does the add operation take O(n) time in the average...

A: ANS: - Option(b) is correct. The time to copy the current entries into a newly allocated, larger arr...

Q: wrote algorithms for the three algorithmy with Three students same pr They tested the two seto of da...

A: Answer in step2