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
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