Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c + + Skills Needed: This machine problem will cover Vectors. NOTE: You must design your own Vector class to solve the problem. You are

c++
Skills Needed: This machine problem will cover Vectors.
NOTE: You must design your own Vector class to solve the problem. You are not allowed to use provided with C++.
Purpose: Write a program to create miniVector so you can solve the following:
For this assignment, you will take the results of a recent election in a small city and report the results in different formats. Remember using is not allowed.
First, you must read the results from a data file and store the values using vectors. The file has the last name of each candidate and the number of votes received on one line. There could be any number of lines in the file so the program needs to count them as it goes.
Finally, you must print the results arranged in order from the winner down to the person with the fewest votes. The report should include only the name of each candidate, the total votes received by that candidate and the percentage of the votes cast in the election for that candidate arranged in order from largest to smallest. Print the percentages with one decimal place.
Create the data file using the following records and put it into the project folder, name the file "votes.txt":
Candidate Votes
Lincoln 5000
Parks 2000
Shakespeare 8000
Ghandi 2500
Ashe 1750
A Sample output will be sent to an output file called "votePctOutput.txt" is as follows:
Candidate Votes Received % Votes
xxxxxxxxxxxx xxxx xx.x
xxxxxxxxxxxx xxxx xx.x
xxxxxxxxxxxx xxxx xx.x

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is focal length? Explain with a diagram and give an example.

Answered: 1 week ago

Question

What is physics and how does it apply in daily life?

Answered: 1 week ago

Question

4 How can you create a better online image for yourself?

Answered: 1 week ago