Question: hi, in java im supposed to create a program that tallys votes for two candidates for office: Tichen and Orator. If 1 is entered then
hi, in java im supposed to create a program that tallys votes for two candidates for office: Tichen and Orator. If 1 is entered then they voted for Tichen, if 2 then voted for Orator, if -1 then there arent any more voters, while other inputs are treated as errors. Then after the vote reading, it should display the total number of votes received, total number of votes for each candidate, the percent of votes each candidate got, and a message to say who wins of if its a tie. So far this is what I have:
import java.util.Scanner; public class PaulAssignment
{ public static void main (String args[]) { Scanner scan = new Scanner (System.in); int userData = scan.nextInt(); int Tichen = 0; int Orator = 0; int total = Tichen + Orator; while(userData == 1 | userData == 2) { System.out.println("Enter your vote
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
