First version: 1.0 finished.
parent
e3606f068b
commit
eee62c38c4
|
@ -1,4 +1,10 @@
|
||||||
1,2
|
,,,,,,,,,
|
||||||
3,4
|
,,,,,,,,,
|
||||||
5,6
|
,,,,,,,,,
|
||||||
7,8
|
,,,,,,,,,
|
||||||
|
,,,,,,,,,
|
||||||
|
,,,,,,,,,
|
||||||
|
,,,,,,,,,
|
||||||
|
,,,,,,,,,
|
||||||
|
,,,,,,,,,
|
||||||
|
,,,,,,,,,
|
||||||
|
|
|
|
@ -15,14 +15,21 @@ public class Axel {
|
||||||
System.out.println("\nAxel(ExcelFakeVon2211482): ");
|
System.out.println("\nAxel(ExcelFakeVon2211482): ");
|
||||||
System.out.print("\nTabellengröße(ReihenZwischen1-99 SpaltenZwischen1-26): ");
|
System.out.print("\nTabellengröße(ReihenZwischen1-99 SpaltenZwischen1-26): ");
|
||||||
Spreadsheet spr = new Spreadsheet(sc.nextInt(), sc.nextInt());
|
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(spr);
|
||||||
System.out.println("\nHILFE (Für eine Anleitung.)\n");
|
System.out.println("\nHILFE (Für eine Anleitung.)\n");
|
||||||
System.out.print("KOMMANDO: ");
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,8 +107,8 @@ public class Spreadsheet {
|
||||||
for(int i = 0; i < memList.size(); i++)
|
for(int i = 0; i < memList.size(); i++)
|
||||||
memArr[i] = (memList.get(i)).split(String.valueOf(separator));
|
memArr[i] = (memList.get(i)).split(String.valueOf(separator));
|
||||||
|
|
||||||
for (int r = getRow(startCellName); r < memList.size(); r++)
|
for (int r = getRow(startCellName)-1; r < memList.size(); r++)
|
||||||
for (int c = getCol(startCellName); c < memList.get(0).length(); c++)
|
for (int c = getCol(startCellName)-1; c < memList.get(0).length(); c++)
|
||||||
if(c<memArr[r].length)
|
if(c<memArr[r].length)
|
||||||
put(r, c, memArr[r][c]);
|
put(r, c, memArr[r][c]);
|
||||||
|
|
||||||
|
@ -443,7 +443,7 @@ public class Spreadsheet {
|
||||||
for (int c = 0; c < cells[r].length; c++)
|
for (int c = 0; c < cells[r].length; c++)
|
||||||
evaluateCell(r, c);
|
evaluateCell(r, c);
|
||||||
}
|
}
|
||||||
public void cellInput() throws FileNotFoundException {
|
public boolean cellInput() throws FileNotFoundException {
|
||||||
Scanner cs = new Scanner(System.in);
|
Scanner cs = new Scanner(System.in);
|
||||||
|
|
||||||
String input = cs.nextLine();
|
String input = cs.nextLine();
|
||||||
|
@ -451,27 +451,38 @@ public class Spreadsheet {
|
||||||
for(int i =0; i<input.split(" ").length; i++)
|
for(int i =0; i<input.split(" ").length; i++)
|
||||||
inputs.add(input.split(" ")[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();
|
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));
|
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));
|
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(toStringShowFormula());
|
||||||
System.out.println("\nEnter zum fortfahren.");
|
System.out.println("\nEnter zum fortfahren.");
|
||||||
cs.nextLine();
|
cs.nextLine();
|
||||||
}else
|
}else {
|
||||||
cells[getRow(inputs.get(0)) - 1][getCol(inputs.get(0)) - 1].setFormula(inputs.get(1));
|
cells[getRow(inputs.get(0)) - 1][getCol(inputs.get(0)) - 1].setFormula(inputs.get(1));
|
||||||
|
System.out.println("\nEnter zum fortfahren.");
|
||||||
updateSpreadsheet();
|
cs.nextLine();
|
||||||
} catch(ArrayIndexOutOfBoundsException a){
|
|
||||||
System.out.println("\nEingegebene Zelle existiert nicht!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inputs.clear();
|
updateSpreadsheet();
|
||||||
|
|
||||||
|
inputs.clear();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
Loading…
Reference in New Issue