forked from hummel/PR1-Spreadsheet
Compare commits
No commits in common. "f19c749e0b4de71f211fa1883a625bb4ebca49d1" and "ba7e093c46e2bd484219a8fb507dfa04f9828da3" have entirely different histories.
f19c749e0b
...
ba7e093c46
|
@ -1,7 +1,6 @@
|
||||||
package de.hs_mannheim.informatik.spreadsheet;
|
package de.hs_mannheim.informatik.spreadsheet;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.util.Scanner;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Part of a simplified spreadsheet system for the PR1 programming lab at Hochschule Mannheim.
|
* Part of a simplified spreadsheet system for the PR1 programming lab at Hochschule Mannheim.
|
||||||
|
@ -12,34 +11,17 @@ public class Axel {
|
||||||
|
|
||||||
public static void main(String[] args) throws FileNotFoundException {
|
public static void main(String[] args) throws FileNotFoundException {
|
||||||
Spreadsheet spr = new Spreadsheet(10,10);
|
Spreadsheet spr = new Spreadsheet(10,10);
|
||||||
String cell, in;
|
|
||||||
Scanner kb = new Scanner(System.in);
|
|
||||||
|
|
||||||
spr.put("A3", "3");
|
spr.put("A3", "123");
|
||||||
spr.put("A2", "1");
|
spr.put("A2", "1");
|
||||||
|
|
||||||
spr.put("B9", "=41+A2");
|
spr.put("B9", "=41+A2");
|
||||||
spr.put("J5", "=7*6");
|
spr.put("J5", "=7*6");
|
||||||
spr.put("J6", "=3/2");
|
spr.put("J6", "=3/2");
|
||||||
|
|
||||||
while(true) {
|
System.out.println(spr);
|
||||||
System.out.println(spr);
|
|
||||||
System.out.print("Cell:");
|
|
||||||
cell=kb.nextLine();
|
|
||||||
if(cell.equals("/exit")) {
|
|
||||||
System.out.println("Auf Wiedersehen");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
System.out.print("Value:");
|
|
||||||
in=kb.nextLine();
|
|
||||||
if(in.equals("/exit")) {
|
|
||||||
System.out.println("Auf Wiedersehen");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
spr.put(cell,in);
|
|
||||||
}
|
|
||||||
spr.saveCsv("/tmp/test.csv");
|
spr.saveCsv("/tmp/test.csv");
|
||||||
kb.close();
|
|
||||||
|
|
||||||
// TODO: You might want to put "UI loop" for entering value and formulas here resp. in some UI methods.
|
// TODO: You might want to put "UI loop" for entering value and formulas here resp. in some UI methods.
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,6 @@ public class Spreadsheet {
|
||||||
public Spreadsheet(int rows, int cols) {
|
public Spreadsheet(int rows, int cols) {
|
||||||
|
|
||||||
// TODO limit the maximum size on 99 (1..99) rows and 26 (A..Z) columns
|
// TODO limit the maximum size on 99 (1..99) rows and 26 (A..Z) columns
|
||||||
if (rows>99){
|
|
||||||
rows=99;
|
|
||||||
}
|
|
||||||
if (cols>26) {
|
|
||||||
cols=26;
|
|
||||||
}
|
|
||||||
|
|
||||||
cells = new Cell[rows][cols];
|
cells = new Cell[rows][cols];
|
||||||
|
|
||||||
|
@ -188,7 +182,7 @@ public class Spreadsheet {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
for (int i = 0; i < cells[0].length; i++) {
|
for (int i = 0; i < cells.length; i++) {
|
||||||
sb.append(" " + (char)('A'+ i) + " | ");
|
sb.append(" " + (char)('A'+ i) + " | ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package de.hs_mannheim.informatik.spreadsheet;
|
||||||
|
|
||||||
|
public class Testdatei {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// Dies ist nur ein test
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue