-2
나는 코드 작성에 문제가있다. 스도쿠 보드 검사기를 만들어야합니다. 목표는 모든 메소드를 검사하고 통과하면 true를 리턴하는 public boolean checkAll()을 사용해야하는 5 가지 특정 메소드를 사용하여 Sudoku 클래스를 확장하는 것입니다 (CheckableSudoku 클래스를 만들기 위해). Heres 내 코드! 내가 너무 혼동이 설명하는 경우 죄송합니다 :/스도쿠 검사기 Java
여기import java.util.Scanner;
public class CheckableSudoku extends Sudoku
{
public int getCell(int xColumn, int yRow)
{
return this.board[xColumn][yRow];
}
public boolean checkRow (int yCoord)
{
int sum = 0;
for (int x = 0; x <9; x++)
{
sum = sum + getCell (x,yCoord);
}
return(true);
}
public boolean checkColumn (int xCoord)
{
int sum = 0;
for (int y = 0; y < 9 ;y++)
{
sum = sum + getCell (xCoord, y);
}
return(true);
}
public boolean checkBlock (int col0to2, int row0to2)
{
int sum = 0;
for (int x=0; x<3; x++)
{
for (int y=0; y<3;y++)
{
sum = sum + getCell (col0to2+x, row0to2+y);
}
}
return(true);
}
public boolean checkAll()
{
// this is the method that checks all the other methods above
return true;
}
public static void main(String[] a)
{
CheckableSudoku me = new CheckableSudoku();
Scanner sc = new Scanner(System.in);
me.read(sc);
System.out.print(me);
System.out.println(me.checkAll());
}
}
구체적으로 무엇이 문제입니까? – Keppil
그리고 귀하의 질문은 무엇입니까? –