Answer to Question #151723 in C++ for Khairul

Question #151723
Each row of “profile.dat” contains the preference list of a voter with the candidates displayed
from the most preferred on the leftmost to the least preferred on the rightmost. In Borda count,
each voter gives a score of points to the most preferred candidate, points to the
second most preferred, and so on. With the header of unsigned borda ( unsigned candidate, unsigned noOfCandidates, std::string
profile). As an example,
file “profile.dat” is as follows:
4 1 2 3
3 1 4 2
2 4 3 1
2 1 3 4
2 1 4 3
4 1 2 3
3 2 4 1
3 2 4 1
The function call is borda( 1 , 4 , "profile.dat" )
returns a value of 10. This is how the total score is obtained. Candidate gets a score of 2
points from each of the first, the second, the fourth, the fifth, and the sixth voters, and 0 point
from each of the remaining voters. Hence the total score is 5x2+3x0=10 points. In a similar
manner, candidates and have total scores 15, 11, and 12, respectively.
1
Expert's answer
2020-12-17T04:54:28-0500
Dear Khairul, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog