public class NewMain { private static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int loopCount = 0; int negativeCount = 0; int num1Count = 0, num2Count = 0, num3Count = 0; int num1, num2, num3; int totalCount = 0; String input1 = "", input2 = "", input3 = ""; do { System.out.print("Num1: "); num1 = sc.nextInt(); System.out.print("Num2: "); num2 = sc.nextInt(); System.out.print("Num3: "); num3 = sc.nextInt(); if (num1 < 0) { negativeCount++; num1Count++; input1 = "Num1"; } if (num2 < 0) { negativeCount++; num2Count++; input2 = "Num2"; } if (num3 < 0) { negativeCount++; num3Count++; input3 = "Num3"; } if ((Continue()) == true) { loopCount++; } } while (Continue()); //this part will ask me to continue, BUT IT SUPPOSED TO ASK ME ONCE, not TWICE System.out.print("\n"); System.out.println("The Total Count Of Negative Numbers That Were Entered Is: " + negativeCount); System.out.print("\n"); System.out.println(loopCount); } public static boolean Continue() { String cont; System.out.print("\n"); System.out.print("Do You Want To Enter Again?: "); cont = sc.next(); if ((cont.equalsIgnoreCase("Y")) || (cont.equalsIgnoreCase("YES"))) { System.out.print("\n"); return true; } else if ((cont.equalsIgnoreCase("N")) || (cont.equalsIgnoreCase("NO"))) { return false; } else { return false; } } }
why is it always asking me the boolean method two times? i cant get rid of it....