Code coach for loop problem - Board Game Players
I'm solving this problem and it technically works (results are correct), but the excercise is still telling me something is wrong. What should I change? Problem: Deck dealer that deals 7 cards - 5x Good Guy, 2x Bad Guy. Write a program that will take the bad guys numbers as input and output all the roles accordingly. My solution is: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); int firstBadGuy = read.nextInt(); int secondBadGuy = read.nextInt(); for(int x=1; x<=7; x++) { if(x==firstBadGuy || x==secondBadGuy) { System.out.println("Bad Guy"); }else{ System.out.println("Good Guy"); } } } }