1
0
Fork 0
PR1-Spreadsheet/Axel/src/de/hs_mannheim/informatik/spreadsheet/Axel.java

58 lines
1.5 KiB
Java
Raw Normal View History

2023-12-12 15:00:07 +01:00
package de.hs_mannheim.informatik.spreadsheet;
2024-01-05 17:39:19 +01:00
import java.util.Scanner;
2023-12-14 08:31:20 +01:00
import java.io.FileNotFoundException;
2023-12-12 15:00:07 +01:00
/**
* Part of a simplified spreadsheet system for the PR1 programming lab at Hochschule Mannheim.
*
* @author Oliver Hummel
*/
public class Axel {
2023-12-14 08:31:20 +01:00
public static void main(String[] args) throws FileNotFoundException {
2024-01-05 17:39:19 +01:00
Spreadsheet spr = new Spreadsheet(10, 10);
2023-12-12 15:00:07 +01:00
spr.put("A3", "123");
spr.put("A2", "1");
2024-01-05 17:39:19 +01:00
2023-12-12 15:00:07 +01:00
spr.put("B9", "=41+A2");
spr.put("J5", "=7*6");
spr.put("J6", "=3/2");
2024-01-05 17:39:19 +01:00
2023-12-12 15:00:07 +01:00
System.out.println(spr);
2024-01-05 17:39:19 +01:00
spr.saveCsv("C:\\Users\\sebas\\IdeaProjects\\PR1-Spreadsheet\\Axel\\resources\\zahlen.csv");
2023-12-14 08:31:20 +01:00
// TODO: You might want to put "UI loop" for entering value and formulas here resp. in some UI methods.
2024-01-05 17:39:19 +01:00
System.out.println("Möchten Sie, die Tabelle bearbeiten (j/n)");
Scanner sc = new Scanner(System.in);
String eingabe = "";
String eingabeCR = "";
String eingabeValue = "";
do {
eingabe = sc.nextLine();
if (eingabe.equals("j")) {
System.out.println("Geben Sie die Spalte (A-J) und die Zeile (1-10)");
eingabeCR = sc.nextLine();
System.out.println("Weisen Sie jetzt einen Wert zu");
eingabeValue = sc.nextLine();
spr.put(eingabeCR, eingabeValue);
System.out.println();
System.out.println(spr);
System.out.println("Möchten Sie weiter machen(j/n)?");
} else if (eingabe.equals("n")) {
System.out.println("Das Programm wird beendet");
break;
} else {
System.out.println("Falsche eingabe bitte erneut versuchen");
}
}while(true);
}
2023-12-12 15:00:07 +01:00
}