My project is finally completed, but my only problem is that my teacher does not accept βbreaksβ in our code. Can someone help me solve this problem, I worked on it for several days, and I just can not get the program to work without using them. Breaks are in my DropYellowDisk and DropRedDisk methods. Another, then this problem, my four connection program is flawless.
private static void DropYellowDisk(String[][] grid) { int number = 0; Scanner keyboard = new Scanner (System.in); System.out.println("Drop a yellow disk at column (1β7): "); int c = 2*keyboard.nextInt()+1; for (int i=6;i>=0;i--) { if (grid[i][c] == " ") { grid[i][c] = "Y"; break; }} } private static void DropRedDisk(String[][] grid) { Scanner keyboard = new Scanner (System.in); System.out.print("Drop a red disk at column (1β7): "); int c = 2*keyboard.nextInt()+1; for (int i =6;i>=0;i--) { if (grid[i][c] == " ") { grid[i][c] = "R"; break; } }}
source share