From df3bb6b59b96e2524e8eb0e33be458459c381271 Mon Sep 17 00:00:00 2001 From: 3011357 <3011357@stud.hs-mannheim.de> Date: Thu, 28 Dec 2023 00:35:11 +0100 Subject: [PATCH] =?UTF-8?q?UI=20Loop=20hinzugef=C3=BCgt.=20Values=20k?= =?UTF-8?q?=C3=B6nnen=20ins=20Spreadsheet=20hinzugef=C3=BCgt=20werden=20+?= =?UTF-8?q?=20Path=20erstellt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../informatik/spreadsheet/Axel.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Axel.java b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Axel.java index df720b3..078d0f8 100644 --- a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Axel.java +++ b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Axel.java @@ -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. }