From 203a833bc6b2cd0ce7f447ea80752ddd6ac851ee Mon Sep 17 00:00:00 2001 From: "Dr.Janson" Date: Sat, 6 Jan 2024 20:40:58 +0100 Subject: [PATCH] Grundrechenarten Fehler behoben mit der 10. Reihe(charAt(1) bei D10 ist 1 also wird in Reihe 1 eingetragen) --- .../informatik/spreadsheet/Axel.java | 20 +++-- .../informatik/spreadsheet/Spreadsheet.java | 80 ++++++++++++++++--- 2 files changed, 79 insertions(+), 21 deletions(-) diff --git a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Axel.java b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Axel.java index 7de087e..fac0c3e 100644 --- a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Axel.java +++ b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Axel.java @@ -16,27 +16,31 @@ public class Axel { Scanner input = new Scanner(System.in); spr.put("A3", "123"); - spr.put("A2", "1"); - spr.put("B9", "=41+A2"); - spr.put("J5", "=7*6"); - spr.put("J6", "=3/2"); + spr.put("B9", "=41+A2+10-2/3"); System.out.println("Schreibe 'stop' zum anhalten."); do{ String command = ""; String form = ""; String cell= ""; + boolean cellTRUE = true; System.out.println(spr); System.out.println("Befehl (z.B. D4_=7*6): "); command = input.nextLine(); if(command.contentEquals("stop")) break; - for(int i = 3; i args = new ArrayList<>(); + + while (m.find()) { + if(!m.group().isEmpty()) { + if(isNumber(m.group())||isCar(m.group())) { + args.add(m.group()); + }else { + if(cells[getRow(m.group())][getCol(m.group())].getValue().isEmpty()) + args.add("0"); + else + args.add(m.group()); + } } } - - return res; + + for(int i = 2; i