UI Loop hinzugefügt. Values können ins Spreadsheet hinzugefügt werden + Path erstellt

Anastasia Kisner 2023-12-28 00:35:11 +01:00
parent c6ce44dac8
commit df3bb6b59b
1 changed files with 23 additions and 3 deletions

View File

@ -1,6 +1,7 @@
package de.hs_mannheim.informatik.spreadsheet;
import java.io.FileNotFoundException;
import java.util.Scanner;
/**
* Part of a simplified spreadsheet system for the PR1 programming lab at Hochschule Mannheim.
@ -11,7 +12,8 @@ public class Axel {
public static void main(String[] args) throws FileNotFoundException {
Spreadsheet spr = new Spreadsheet(10,10);
Scanner keyboard = new Scanner(System.in);
spr.put("A3", "123");
spr.put("A2", "1");
@ -20,8 +22,26 @@ public class Axel {
spr.put("J6", "=3/2");
System.out.println(spr);
spr.saveCsv("/tmp/test.csv");
while(true){
System.out.println("Please enter the cell name: ");
String cellName = keyboard.nextLine();
System.out.println("Please enter your value or your formula: ");
String cellValue = keyboard.nextLine();
spr.put(cellName, cellValue);
System.out.println(spr);
System.out.println("Do you want to end the program? Y/N");
if(keyboard.nextLine().equalsIgnoreCase("Y")){
break;
}
}
spr.saveCsv("C:/Users/kisne/IdeaProjects/PR1-Spreadsheet/tmp/test.csv");
// TODO: You might want to put "UI loop" for entering value and formulas here resp. in some UI methods.
}