rendered paste bodypublic class Position {
private char row = 'Z';
private int column = 0;
private int rowIndex = 0;
private int colIndex = 0;
public Position(char r, int col){
row = r;
if(row == 'A' || row == 'a')
rowIndex = 0;
else if(row == 'B' || row == 'b')
rowIndex = 1;
else if(row == 'C' || row == 'c')
rowIndex = 2;
else if(row == 'D' || row == 'd')
rowIndex = 3;
else if(row == 'E' || row == 'e')
rowIndex = 4;
else if(row == 'F' || row == 'f')
rowIndex = 5;
else if(row == 'G' || row == 'g')
rowIndex = 6;
else if(row == 'H' || row == 'h')
rowIndex = 7;
else if(row == 'I' || row == 'i')
rowIndex = 8;
else if(row == 'J' || row == 'j')
rowIndex = 9;
column = col;
colIndex = col - 1;
}
public Position(int R, int Col){
rowIndex = R;
colIndex = Col;
column = Col + 1;
}
public char row(){
if(row != 'Z'){
return row;
}
if(rowIndex == 0)
row = 'A';
else if(rowIndex == 1)
row = 'B';
else if(rowIndex == 2)
row = 'C';
else if(rowIndex == 3)
row = 'D';
else if(rowIndex == 4)
row = 'E';
else if(rowIndex == 5)
row = 'F';
else if(rowIndex == 6)
row = 'G';
else if(rowIndex == 7)
row = 'H';
else if(rowIndex == 8)
row = 'I';
else if(rowIndex == 9)
row = 'J';
return row;
}
public int column(){
return column;
}
public int rowIndex(){
return rowIndex;
}
public int columnIndex(){
return colIndex;
}
public String toString(){
return (row() + "-" + column());
}
}