Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- import java.io.*;
- public class EraseProjectPKagranaPeriod3 {
- Scanner in = null;
- private String[][] grid = new String[20][20];
- private int xPos, yPos;
- public static void main(String[] args) {
- EraseProjectPKagranaPeriod3 e = new EraseProjectPKagranaPeriod3();
- System.out.println(" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19" + "\n");
- e.loadFile();
- e.erase();
- }
- public void loadFile() {
- File inFile = new File("digital.txt");
- try{
- in = new Scanner(inFile);
- }catch(FileNotFoundException e){
- System.out.println(e.getMessage());
- }
- int firstNum = in.nextInt();
- while(in.hasNext()) {
- int row = in.nextInt();
- int col = in.nextInt();
- grid[row-1][col-1] = "@";
- } // end of while-loop
- for (int i = 0; i < grid.length; i++) {
- for (int j = 0; j < grid.length; j++) {
- if(grid[i][j] != "@") {
- grid[i][j] = "-";
- }
- }
- } // end of outer for-loop
- // for printing
- for (int i = 0; i < grid.length; i++) {
- System.out.print( (i+1) + " ");
- for (int j = 0; j < grid[i].length; j++) {
- System.out.printf("%3s", grid[i][j]);
- }
- System.out.println();
- } // end of outer for-loop
- } // end of method
- public void erase() {
- Scanner input = new Scanner(System.in);
- System.out.print("\nEnter y coordinate of point to erase: ");
- yPos = input.nextInt();
- System.out.print("Enter x coordinate of point to erase: ");
- xPos = input.nextInt();
- }
- public void move() {
- /*
- If the element at (xPos, yPos) is part of an object
- then you will want to erase that entire object
- */
- }
- }// end of class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement