Answered step by step
Verified Expert Solution
Question
1 Approved Answer
: Write a program Election that computes the tally in a write - in election, and announces the winner. Since the votes are write -
: Write a program Election that computes the tally in a writein election, and
announces the winner. Since the votes are writein there is no predetermined set of
candidates. Whoever appears the most in the votes is the winner. The user enters the
individual votes, one vote per line, and ends entering with typing or an empty line. Tocompute the tally, the program uses two arrays, a String variable names and an int
variable count Upon receiving a single vote, the program checks if the name on the
vote appears in names, and if it does, the program adds to the value of the element in
count. If the name does not appear in names, the program extends both arrays by one
element, stores the name in names at the last position and store in count at the last
position. In this manner, the two arrays will have the same lengths. The initial length is
for both arrays. and also provise flowchart
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started