1
0
Fork 0

Spreadsheet new uiMethod cellInput implemented.

pull/1/head
selim 2023-12-27 04:06:50 +01:00
parent 82406c871d
commit 8a9fe270b1
2 changed files with 26 additions and 4 deletions

View File

@ -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);

View File

@ -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<String> 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();