From fd8638be9e58c96cc23551f61c4f05c8c8a51330 Mon Sep 17 00:00:00 2001
From: Kraemerd <Dominic_Daniel.Kraemer@Student.Reutlingen-University.de>
Date: Sat, 7 Jan 2023 14:58:40 +0100
Subject: [PATCH] implemented basic FileReader functions in main.java

---
 expressions.txt      |  4 +++-
 src/Application.java | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/expressions.txt b/expressions.txt
index 8ef200f..e06786f 100644
--- a/expressions.txt
+++ b/expressions.txt
@@ -1 +1,3 @@
-1 + xy^2 - (31 * x)y
\ No newline at end of file
+1 + xy^2 - (31 * x)y
+1 + x^2 - (3 * x)
+2x + 0,5x^2 - 1
\ No newline at end of file
diff --git a/src/Application.java b/src/Application.java
index f9d586f..dedb78a 100644
--- a/src/Application.java
+++ b/src/Application.java
@@ -1,8 +1,27 @@
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
 import java.util.Arrays;
 import java.util.List;
 
 public class Application {
     public static void main(String[] args) {
+        BufferedReader reader;
+        String datapath = "expressions.txt";
+        try {
+            System.out.println("Reading the file:");
+            reader = new BufferedReader(new FileReader(datapath));
+            String line = reader.readLine();
+            while(line != null) {
+                System.out.println(line);
+                line = reader.readLine();
+            }
+            System.out.println();
+            reader.close();
+        }
+        catch (IOException e ) {
+            e.printStackTrace();
+        }
         //List with a fitting String to be parsed into multiple tokens
         List<String> test = Arrays.asList("1 + xy^2 - (31 * x)y");
         //Iterates through every String
-- 
GitLab