1
0
Fork 0

First version: 1.0 finished.

pull/1/head
selim 2023-12-27 06:02:19 +01:00
parent e3606f068b
commit eee62c38c4
3 changed files with 54 additions and 30 deletions

View File

@ -1,4 +1,10 @@
1,2
3,4
5,6
7,8
,,,,,,,,,
,,,,,,,,,
,,,,,,,,,
,,,,,,,,,
,,,,,,,,,
,,,,,,,,,
,,,,,,,,,
,,,,,,,,,
,,,,,,,,,
,,,,,,,,,

1 1 2
2 3 4
3 5 6
4 7 8
5
6
7
8
9
10

View File

@ -15,14 +15,21 @@ public class Axel {
System.out.println("\nAxel(ExcelFakeVon2211482): ");
System.out.print("\nTabellengröße(ReihenZwischen1-99 SpaltenZwischen1-26): ");
Spreadsheet spr = new Spreadsheet(sc.nextInt(), sc.nextInt());
String help = "n";
boolean stop = false;
while (true) {
while (!stop) {
try {
System.out.println(spr);
System.out.println("\nHILFE (Für eine Anleitung.)\n");
System.out.print("KOMMANDO: ");
spr.cellInput();
stop = spr.cellInput();
} catch(Exception e){
System.out.println("\nEingabe unzulässig!");
System.out.println("\nEnter zum fortfahren.");
sc.nextLine();
sc.nextLine();
}
}
}

View File

@ -107,8 +107,8 @@ public class Spreadsheet {
for(int i = 0; i < memList.size(); i++)
memArr[i] = (memList.get(i)).split(String.valueOf(separator));
for (int r = getRow(startCellName); r < memList.size(); r++)
for (int c = getCol(startCellName); c < memList.get(0).length(); c++)
for (int r = getRow(startCellName)-1; r < memList.size(); r++)
for (int c = getCol(startCellName)-1; c < memList.get(0).length(); c++)
if(c<memArr[r].length)
put(r, c, memArr[r][c]);
@ -443,7 +443,7 @@ public class Spreadsheet {
for (int c = 0; c < cells[r].length; c++)
evaluateCell(r, c);
}
public void cellInput() throws FileNotFoundException {
public boolean cellInput() throws FileNotFoundException {
Scanner cs = new Scanner(System.in);
String input = cs.nextLine();
@ -451,27 +451,38 @@ public class Spreadsheet {
for(int i =0; i<input.split(" ").length; i++)
inputs.add(input.split(" ")[i]);
try {
if(inputs.contains("HILFE"))
if (inputs.contains("STOP")) {
System.out.println("\nDas Programm wurde beendet.");
return true;
} else if (inputs.contains("HILFE")) {
Axel.help();
else if (inputs.contains("EINLESEN"))
System.out.println("\nEnter zum fortfahren.");
cs.nextLine();
}else if (inputs.contains("EINLESEN")){
readCsv(inputs.get(1), inputs.get(2).charAt(0), inputs.get(3));
else if (inputs.contains("SPEICHERN"))
System.out.println("\nEinlesen erfolgreich.");
System.out.println("\nEnter zum fortfahren.");
cs.nextLine();
}else if (inputs.contains("SPEICHERN")) {
saveCsv(inputs.get(1));
else if (inputs.contains("FORMELN")) {
System.out.println("\nSpeichern erfolgreich.");
System.out.println("\nEnter zum fortfahren.");
cs.nextLine();
}else if (inputs.contains("FORMELN")) {
System.out.println(toStringShowFormula());
System.out.println("\nEnter zum fortfahren.");
cs.nextLine();
}else
}else {
cells[getRow(inputs.get(0)) - 1][getCol(inputs.get(0)) - 1].setFormula(inputs.get(1));
updateSpreadsheet();
} catch(ArrayIndexOutOfBoundsException a){
System.out.println("\nEingegebene Zelle existiert nicht!");
System.out.println("\nEnter zum fortfahren.");
cs.nextLine();
}
inputs.clear();
updateSpreadsheet();
inputs.clear();
return false;
}
public String toString() {
StringBuilder sb = new StringBuilder();