Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MAKE A C PROGRAM. Company ballots require that voters rank all the candidates in order of choice. Fixed values (Constants) Candidate ID Candidate Name John

MAKE A C PROGRAM.

Company ballots require that voters rank all the candidates in order of choice.

Fixed values (Constants)

Candidate ID Candidate Name

John Doe

Jane Smith

Jay Roberts

Input

Up to 1,000 lines, each containing the contents of a ballot. Each ballot contains the numbers from 1 to 3 in some order. The rst number indicates the candidate ID of rst choice; the second number indicates candidate ID of second choice, and the third number indicates candidate ID of third choice. The input will be terminated by a line containing three zeros, which should not be processed. Conflicting inputs are allowed (e.g 3 3 1)

Output

The program will ignore ballots with conflicting inputs (e.g. 1 2 2). The output of each test case consists of the total point earned by each candidate (1 point for First Choice, 2 points for Second Choice, 3 points for Third Choice). Then either a single line containing the name of the winner or several lines containing the names of all candidates who are tied. The output of each two consecutive cases are separated by a blank line.

Sample Input

1 2 3

2 1 3

2 3 1

1 2 3

3 1 2

1 3 2

0 0 0

Sample Output

John Doe= 10pts

Jane Smith= 12pts

Jay Roberts= 14pts

Winner: John Doe

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

9. How are they similar to you? (specifically)

Answered: 1 week ago

Question

13. What are their tastes? (refined, middle class, or subsistence)

Answered: 1 week ago