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.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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue