Question: Instructions Carefully read through the project objectives and activities an ensure your solution correctly meets the objectives. Note: Submission of any ChatGPT - generated code

Instructions
Carefully read through the project objectives and activities an ensure your solution correctly meets the objectives.
Note: Submission of any ChatGPT - generated code or segment of code will result in total score of 10% of the total score for this project
------------------------------------------------------------------------------------------
Project Objectives:
Read Votes from File
Create a function to read the votes from the "casted_votes" file and organize them for counting.
Count Votes per Candidate and Write Results to File
Implement a function to count the number of votes cast for each candidate in the read vote data and write the results into the "counted_votes" file.
Check for Simple Majority
Develop a method to determine if any candidate in the first-choice list receives more than 50% of the votes.
Identify Equal Votes
Implement a function to check if all candidates in the first-choice list have an equal number of votes.
Ranked Choice Voting Algorithm (RCV)
Write a function that executes the RCV algorithm using the read vote data:
If a candidate gets more than 50% of the first-choice votes, declare that candidate as the winner.
If no candidate has a majority, eliminate the candidate with the fewest votes and redistribute their votes to the next available choices.
Continue eliminating candidates until a winner with a majority is determined.
Steps to Implement:
Read Votes from File
Create functions to read the votes from the "casted_votes" file.
Vote Counting and Writing Results to File
Implement functions to tally the votes for each candidate based on the read file data and write the results into the "counted_votes" file.
Majority Determination
Develop a function to check if any candidate has a simple majority in the read vote data.
Elimination and Redistribution
Write a function to eliminate the candidate with the fewest votes and redistribute those votes to the next available choices based on the read vote data.
Loop for RCV Process
Implement a loop to execute the RCV process until a winner is determined using the read vote data.
-------------------------------------------------------------------------------------------
Note:
1. Each of the objectives carries maximum score of 6
2. Total score for this project =6*5=>30
3. Project submission date is Sunday, 14th April, 2024 @ 11:59pm
4. Submission format: Python script (with .py extension)
5. Project defense date: The date and time scheduled for the written examination for this course
6. Defense Order: To be decided by the course Lecturer
Example (Apology; there was an error in the elimination process in the example which has now been corrected)
Suppose there are 5 candidates (A, B, C, D, E) and 20 voters who rank them as follows:
6 voters rank: A > B > C > D > E
5 voters rank: B > C > A > D > E
4 voters rank: C > B > D > A > E
3 voters rank: D > E > C > B > A
2 voters rank: E > D > C > B > A
In the first round of counting, the votes are tallied:
A receives 6 votes
B receives 5 votes
C receives 4 votes
D receives 3 votes
E receives 2 votes
Since no candidate has a majority (more than half of the total votes), the candidate with the fewest votes (E) is eliminated. Their votes are then redistributed to the remaining candidates based on the next available choice on each ballot:
The 2 voters who ranked E first now have their votes redistributed to D.
C has 4 votes and it is eliminated. The 4 voters who ranked C > B > D > A > E now have their votes redistributed to B
The 5 voters who ranked B > C > A > D > E already have their votes counted for B.
After redistributing the votes, the tallies are:
A: 6 votes
B: 9 votes
C: 0 votes
D: 5 votes
E: 0 votes
D now has the fewest number of votes and is eliminated. The 5 voters who rank D > E > C > B > A now have their votes redistributed to B
Final counts: A: 6, B: 14, C: 0, D: 0, E: 0
Now, B has the most votes (14 out of 20 remaining votes after eliminating D), so B wins the election.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!