import java.io.*; import java.util.*; public class EraseObject { final static int MAXCOL=20; final static int MAXROW=20; final static char BLANK=' '; public static void main (String []args)throws IOException { int x=0; int y=0; Scanner s=new Scanner(System.in); String sentinel="y"; EraseObject object=new EraseObject(); char[][]matrix=new char[MAXROW+1][MAXCOL+1]; object.loadMatrix(matrix); object.printMatrix(matrix); while (sentinel.equals("y")||sentinel.equals("Y")) { System.out.print("Enter a row\t"); x=s.nextInt(); System.out.print("Enter a column\t"); y=s.nextInt(); object.erase(matrix,x,y); object.printMatrix(matrix); System.out.println("Do you want to continue?"); sentinel=s.next(); } } public void printMatrix(char [][]matrix)throws IOException { PrintWriter outfile=new PrintWriter(new FileWriter("outData.dat",true)); System.out.println(" 12345678901234567890"); for (int row=1;row<=20;row++) { System.out.print(row%10+" "); for (int col=1;col<=20;col++) { outfile.print(""+matrix[row][col]); System.out.print(""+matrix[row][col]); } System.out.println(); outfile.println(); } System.out.println(); outfile.println(); outfile.close(); } public void loadMatrix(char[][]matrix) throws IOException { int x=0; int y=0; try { FileReader reader=new FileReader("digital.txt"); Scanner sf=new Scanner(reader); int numPairs=sf.nextInt(); for (int row=0;row<=20;row++) { for (int col=0;col<=20;col++) { matrix[row][col]='-'; } } for (int i=0;i