Question: Write a Python program that creates a class which represents a Candidate in an election. The class must have the candidates first and last name,

Write a Python program that creates a class which represents a Candidate in an election. The class must have the candidates first and last name, as well as the number of votes received as attributes. The class must also have a method that allows the user to set and get these attributes. Create a separate test module where instances of the class are created, and the methods are tested. Create instances of the class to represent 5 candidates in the election, then it should output each candidates name, the votes received by that candidate, and the percentage of the total votes received by the candidate. Your program should also output the winner of 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 Databases Questions!