Question: Need as a Java program. You are asked to write two Java programs to help election officials to tally election results. The first program is

Need as a Java program.Need as a Java program. You are asked to write two Javaprograms to help election officials to tally election results. The first programis used inside individual precincts to count the number of votes for

You are asked to write two Java programs to help election officials to tally election results. The first program is used inside individual precincts to count the number of votes for each candidate. On the other hand, the second program is used to count the votes collected by the different precincts. Question 1 Assume there are two candidates for office'Polly Tichen' and 'Ernest Orator'. Write a Java program that reads a sequence of numbers from the user and the sequence of numbers terminates when - 1 is entered. The sequence of numbers read is interpreted as follows: 1 if the user is voting for Tichen. 2 if the user is voting for Orator. -1 to indicate there are no more voters. Any other input is treated as error and your program should display an error messages to notify the user. After reading all the votes, your program should print out the following: The total number of votes received overall. The total number of votes received for each candidate. The percent of votes each candidate received. A message to say who wins or if there is a tie. Sample run: Enter your vote 1>1>1>1>1>1>1>

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!