*This was already posted, but no one answered it. I am pretty lost with this pro
ID: 3690359 • Letter: #
Question
*This was already posted, but no one answered it. I am pretty lost with this project and would love at least a basic setup/prototype
election c++ program:
election against the President for leadership of the hospital.
What does the fox say? Whatever WE tell it to.
From now on the annual Cinco de Mayo party will be held on March 8.
Beginning this year, patients shall have a week dedicated to us.
Doctors are now allowed to talk about fight club.
When in our hospital, patients must clean up after themselves.
Our paychecks will immediately include royalties from the parking funds.
From now on the President will take our birthdays off.
If we say something costs and arm and a leg, it does.
New staff members are ordered to learn OUR secret handshake.
If a patient needs help and no one is around, the new President will handle them.
All must pass by a 2/3 majority.
General Election Procedures
The voting proceeded as follows:
· Hospital staff stand in line to electronically cast their votes using machines made in Ohio.
· Each hospital staff has been assigned a unique number that they enter on the ballot.
· They enter the name of the candidate they are voting for, either “the President” or “the new guy”.
· They enter Y or N for issues 1 through 10.
· The candidate with the most votes becomes the new hospital’s President.
· The candidate with the second most votes becomes the new Vice President.
Note that the hospital staff is sometimes known for trying a trick or two. They tend to get back in line and vote again with the “vote early and vote often” philosophy, and the machines let them get away with it. They are not, however, smart enough to use a different number. Your file will contain a sorted list of votes with possible duplicates. You need to check the current hospital staff number with any duplicates to see if that hospital staff has already cast a ballot. Only keep and tally the results of the first ballot for each hospital staff. Ignore duplicates even if they voted differently the second or third or fourth time. Note that not all numbers may be used, i.e., hospital staff registration numbers may be 5, 13, 21, 34, etc. Therefore, you’ll need to keep track of how many hospital staff members actually voted. You cannot rely on the last hospital staff registration number.
Ballots are stored automatically in a file called ballots.txt. The file only will hold a maximum of 100 hospital staff ballots. You need to open this file and read each ballot (one per line) until the end of the file. Sample ballots.txt file:
1YYYYYYYYYYThe New Guy
2YNYNYNYNYNThe President
2YNNYYNNYYNThe President
2NNNNNNNNNNThe New Guy
3NYNYNYNYNYThe New Guy
3YYYYYYYYYYThe President
7YNYNYNYNYNThe New Guy
Note the format of each data line:
<integer> <char> <char> <char> <char> <char> <char> <char> <char> <char> <char> <string>
This Assignment
Your task is three-fold. First, as you read in the ballots, create parallel arrays full of all of the ballot file’s ballots, but that keeps or contains only those ballots that were used in the count, and not the duplicates. Remember that will be the first vote you encounter in the data for each hospital staff. You will also need to keep track of all of the “cheat” votes, those that were duplicates or triplicates or … You will not need to store those in any form except to accumulate a total of them.
Next, you will need to create a new file (counted.txt) and simply write out your good ballots from your arrays into this file. It will end up looking like the original ballot.txt, less those duplicated votes that you did not put into your arrays.
Finally, determine the results of the election and print them out on the screen. Your output should include:
1. The candidate name list and how many votes each received.
2. How many total votes were cast. (This includes the cheat ballots.)
3. How many actual hospital staff members voted.
4. If each issue passed or failed and the number of yes votes it received.
5. Who the new President and Vice President are.
For example:
4 hospital staff voted in this election using 8 ballots.
President (most votes): The New Guy (with 3 votes)
Vice President: The President (with 1 vote)
Amendment #1 passes (3 Y, 1 N) – 75% met
Amendment #2 fails (2 Y 2 N) – 50% is not a majority
Amendment #3 passes (3 Y, 1 N) – 75% met
Amendment #4 fails (2 Y 2 N) – 50% is not a majority
Amendment #5 passes (3 Y, 1 N) – 75% met
Amendment #6 fails (2 Y 2 N) – 50% is not a majority
Amendment #7 passes (3 Y, 1 N) – 75% met
Amendment #8 fails (2 Y 2 N) – 50% is not a majority
Amendment #9 passes (3 Y, 1 N) – 75% met
Amendment #10 fails (2 Y 2 N) – 50% is not a majority
What does the fox say? Whatever WE tell it to.
From now on the annual Cinco de Mayo party will be held on March 8.
Beginning this year, patients shall have a week dedicated to us.
Doctors are now allowed to talk about fight club.
When in our hospital, patients must clean up after themselves.
Our paychecks will immediately include royalties from the parking funds.
From now on the President will take our birthdays off.
If we say something costs and arm and a leg, it does.
New staff members are ordered to learn OUR secret handshake.
If a patient needs help and no one is around, the new President will handle them.
Explanation / Answer
Ans;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.