diff --git a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Axel.java b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Axel.java index fb7971b..652fac5 100644 --- a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Axel.java +++ b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Axel.java @@ -16,10 +16,6 @@ public class Axel { while (true) { - - spr.cells[sc.nextInt()-1][5].setFormula(sc.next()); - spr.updateSpreadsheet(); - System.out.println(spr.toStringShowFormula()); System.out.println(spr); diff --git a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java index 256189b..6f2a3a7 100644 --- a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java +++ b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java @@ -443,6 +443,32 @@ public class Spreadsheet { for (int c = 0; c < cells[r].length; c++) evaluateCell(r, c); } + public void cellInput() throws FileNotFoundException { + Scanner cs = new Scanner(System.in); + + String input = cs.nextLine(); + ArrayList inputs = new ArrayList<>(); + inputs.add(input.split(" ")[0]); + inputs.add(input.split(" ")[1]); + + try { + if (inputs.contains("EINLESEN")) + readCsv(inputs.get(1).split(" ")[0], inputs.get(1).split(" ")[1].charAt(0), inputs.get(1).split(" ")[2]); + else if (inputs.contains("SPEICHERN")) + saveCsv(inputs.get(1)); + else if (inputs.contains("FORMELN")) + System.out.println(toStringShowFormula()); + else + cells[getRow(inputs.get(0)) - 1][getCol(inputs.get(1)) - 1].setFormula(cs.next()); + + updateSpreadsheet(); + } catch(ArrayIndexOutOfBoundsException a){ + System.out.println("\nEingegebene Zelle existiert nicht!"); + } + + inputs.clear(); + + } public String toString() { StringBuilder sb = new StringBuilder();