From c22553f0d58bcb798e4a6e7fb4ccab37ab197d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Wed, 23 Mar 2022 07:29:25 +0100 Subject: [PATCH] first part of Lab13 --- bin/lab13_streams/GarageManager.class | Bin 2950 -> 3487 bytes bin/lab13_streams/ReadFileApplication.class | Bin 4038 -> 4689 bytes drawingTest.svg | 4 +++ src/lab13_streams/GarageManager.java | 12 ++++++++- src/lab13_streams/ReadFileApplication.java | 26 +++++++++++++++++++- 5 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 drawingTest.svg diff --git a/bin/lab13_streams/GarageManager.class b/bin/lab13_streams/GarageManager.class index 3e50b5d19bff660eefc326063b891a34e806ffae..9692dba96bf9b1362f9c2d78b036b3d276c8f4fe 100644 GIT binary patch delta 697 zcmZ9K%TE(g6vls-4s+{RCDstBCepZ3qcCx0QsN^KNQ@wm5>2BC4$WwarEThPPQNc&4PLcXr`$wr~SCLuV@-_t~z!mZ+B+0ZqJBU81a%`(RGHyJWy;qk+5xVxM16Z znQXSz8}%$E>CikW{v4o%&an#&@o-(NUCLt zV^!LtPkc_s>LvJe`#g(jpO)FGr?&=^l*<}rs!jaBnJg~UWO%(_&{0SVVUkCt-{wN6&1#*V>dVXD77KlImai- z8N!*wmt4K@w@_sXQ&jfwnPs$SY@x;%Oj|5LGj+e^!_<7$D9v5X@s$|-Eo>FF;HK8` F{SS&VwUGb- delta 178 zcmXAj%L+kZ6otRzKlD497`fF^%7~a9BSMH`pm-W{2F%XD{qhPYGXoExyoSe+Rob=M zd$qpRz801l@AZ8=fd;q8TNx)GPTkx+GHVkCc6k5Ty7749l2B+K7E`lDq%B58TEa>L zX`3t^e7cnBY5I&AFk?hjiPoQH%TAYN!k!wAm?j67YV-BLkqt&{nv*|6NH34iO7!YBynIuCuyX)*E5UOpZ zs8#W*wOXsKcu}!cK-k1aDpf361zQia9>x2tw^p>)_*T>sR$@2+-vk0 zRZ%0>QMI{suNiR^;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bwAFmjD0& diff --git a/drawingTest.svg b/drawingTest.svg new file mode 100644 index 0000000..9d590de --- /dev/null +++ b/drawingTest.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/lab13_streams/GarageManager.java b/src/lab13_streams/GarageManager.java index 31c61ac..e535247 100644 --- a/src/lab13_streams/GarageManager.java +++ b/src/lab13_streams/GarageManager.java @@ -27,7 +27,7 @@ public class GarageManager { Object[] keys = services.keySet().toArray(); String result = ""; - result += "*************************\n"; + result += "*******************************\n"; result += "* Super Auto 20000 invoice ****\n"; result += "*******************************\n\n"; @@ -70,6 +70,16 @@ public class GarageManager { System.out.println(bill2); // Complete with your code here ! + + try { + FileOutputStream bill = new FileOutputStream("C://tmp//bill.txt"); + PrintWriter billWriter = new PrintWriter(bill); + billWriter.print(bill1 + "\n\n\n\n\n\n\n" + bill2); + billWriter.close(); + } catch (Exception e) { + System.out.println("File can't be written"); + e.printStackTrace(); + } } } diff --git a/src/lab13_streams/ReadFileApplication.java b/src/lab13_streams/ReadFileApplication.java index 374a8e5..24ff219 100644 --- a/src/lab13_streams/ReadFileApplication.java +++ b/src/lab13_streams/ReadFileApplication.java @@ -29,6 +29,30 @@ public class ReadFileApplication { BufferedReader csvReader = new BufferedReader(new FileReader(in)); // TODO: complete here + String line; + do { + line = csvReader.readLine(); + + if(line == null) break; + + String[] str = new String[7]; + str = line.split(";"); + + Point p1 = new Point(); + p1.x = Integer.parseInt(str[0]); + p1.y = Integer.parseInt(str[1]); + + Point p2 = new Point(); + p2.x = Integer.parseInt(str[2]); + p2.y = Integer.parseInt(str[3]); + + Color color = new Color( + Integer.parseInt(str[4]), + Integer.parseInt(str[5]), + Integer.parseInt(str[6]) + ); + lines.add(new Line(p1, p2, color)); + } while (!line.isEmpty()); System.out.println(lines.size() + " shapes found in csv file."); csvReader.close(); @@ -50,7 +74,7 @@ public class ReadFileApplication { * Entry point of the program */ public static void main(String[] args) { - Vector theLines = ReadFileApplication.parseFile("drawingTest.csv"); + Vector theLines = ReadFileApplication.parseFile("src/lab13_streams/data/drawingTest.csv"); // Display what we read ReadFileApplication.displayLines(theLines);