diff --git a/bin/lab13_streams/GarageManager.class b/bin/lab13_streams/GarageManager.class index 3e50b5d..9692dba 100644 Binary files a/bin/lab13_streams/GarageManager.class and b/bin/lab13_streams/GarageManager.class differ diff --git a/bin/lab13_streams/ReadFileApplication.class b/bin/lab13_streams/ReadFileApplication.class index c867d9b..c981cf7 100644 Binary files a/bin/lab13_streams/ReadFileApplication.class and b/bin/lab13_streams/ReadFileApplication.class differ 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);