import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String[] questions = {
"Do you support BLM?",
"Do you support LGBTQ+?",
"Do you support the carrying of personal weapons?"
};
String[] answers = {"n", "n", "y"};
String answer;
int democrat = 0;
int republican = 0;
System.out.println("Answer 'y' or 'n' on questions.");
for (int i = 0; i < questions.length; i++) {
System.out.println(questions[i]);
answer = in.nextLine();
if (answer.equalsIgnoreCase("y") || answer.equalsIgnoreCase("n")) {
if (answers[i].equalsIgnoreCase(answer)) {
republican++;
} else {
democrat++;
}
}
}
System.out.println(republican > democrat ? "You are a republican." :
(republican < democrat ? "You are a democrat." : "Take the survey again."));
}
}
Comments
Leave a comment