public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter dimensions"); NUM_ROWS = sc.nextInt(); NUM_COLS = sc.nextInt(); SpreadsheetState spreadsheet = new SpreadsheetState(); System.out.println("No of entries"); int entries = sc.nextInt(); System.out.println("Enter the element row and column followed by the expression"); for (int i = 0; i < entries; ) { // The row and column must be space seperated String row = sc.next(); if (Util.toInt(row.toCharArray()) >= NUM_ROWS) { System.out.println("Exceeded row size"); continue; } int column = sc.nextInt(); if (column >= NUM_COLS) { System.out.println("Exceeded column size"); continue; } spreadsheet.setExpression(new CellLocation(row + column), sc.next()); spreadsheet.recalculate(); i++; } for (int i = 0; i < 5; i++) { System.out.println("Look at value..?"); String element = sc.next(); System.out.println(spreadsheet.getValue(new CellLocation(element))); } System.out.println(spreadsheet); sc.close(); }