Question: please add comment every line of code: Design and implement a simplified voting machine class with the following specification. A voting machine has a list

please add comment every line of code:

Design and implement a simplified voting machine class with the following specification. A

voting machine has a list of candidates and the following methods:

i) addCandidate(String name) /* Add a candidate with the name to the list */

ii) castVote(String name) /* Cast a vote to the candidate with the name */

iii) printResults() /* Print out the number of votes each candidate has received. The

order does not matter */

Assume that only two attributes of a candidate, namely, the name and number of votes, are of

interest here, and the size of the candidate list is unknown in advance.

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 Programming Questions!