Browse Source

read file and print contents to console

Eric Foster 6 years ago
parent
commit
89e44d587f
3 changed files with 68 additions and 31 deletions
  1. 7
    0
      HipsterIpsum.txt
  2. 18
    0
      HipsterIpsumReader.java
  3. 43
    31
      package.bluej

+ 7
- 0
HipsterIpsum.txt View File

@@ -0,0 +1,7 @@
1
+Lorem ipsum dolor amet wolf tattooed yr, 90's tbh subway tile
2
+neutra pok pok pabst iceland echo park ethical hoodie blue bottle.
3
+Trust fund typewriter normcore, venmo neutra four dollar toast narwhal
4
+freegan forage biodiesel snackwave before they sold out you probably
5
+haven't heard of them. Glossier tattooed plaid tumeric crucifix leggings
6
+skateboard farm-to-table sustainable blue bottle umami brunch.
7
+Tbh stumptown raw denim cred austin coloring book.

+ 18
- 0
HipsterIpsumReader.java View File

@@ -0,0 +1,18 @@
1
+import java.io.*;
2
+import java.util.*;
3
+import java.text.*;
4
+
5
+public class HipsterIpsumReader
6
+{
7
+    TextIO textIO = new TextIO();
8
+    String fileName = "HipsterIpsum.txt";
9
+    public void readFile() throws IOException {
10
+        BufferedReader br = textIO.open(fileName);
11
+        boolean endOfFile = false;
12
+        while (!endOfFile){
13
+            String fileContents = br.readLine();
14
+            System.out.println(fileContents);
15
+            if(br.readLine()==null)endOfFile=true;
16
+        }
17
+    }
18
+}

+ 43
- 31
package.bluej View File

@@ -1,25 +1,37 @@
1 1
 #BlueJ package file
2
-dependency1.from=Account
3
-dependency1.to=AccountException
2
+dependency1.from=Calendar1
3
+dependency1.to=CalendarGraphic
4 4
 dependency1.type=UsesDependency
5
-dependency2.from=DepositAccount
6
-dependency2.to=AccountException
5
+dependency2.from=Calendar1
6
+dependency2.to=DateException
7 7
 dependency2.type=UsesDependency
8
-editor.fx.0.height=722
9
-editor.fx.0.width=800
10
-editor.fx.0.x=114
11
-editor.fx.0.y=175
8
+dependency3.from=Account
9
+dependency3.to=AccountException
10
+dependency3.type=UsesDependency
11
+dependency4.from=Calendar
12
+dependency4.to=DateException
13
+dependency4.type=UsesDependency
14
+dependency5.from=Date
15
+dependency5.to=DateException
16
+dependency5.type=UsesDependency
17
+dependency6.from=DepositAccount
18
+dependency6.to=AccountException
19
+dependency6.type=UsesDependency
20
+editor.fx.0.height=976
21
+editor.fx.0.width=1274
22
+editor.fx.0.x=-311
23
+editor.fx.0.y=-1040
12 24
 objectbench.height=101
13
-objectbench.width=461
14
-package.divider.horizontal=0.6
25
+objectbench.width=434
26
+package.divider.horizontal=0.6074380165289256
15 27
 package.divider.vertical=0.8007380073800738
16 28
 package.editor.height=427
17
-package.editor.width=674
18
-package.editor.x=1006
19
-package.editor.y=133
29
+package.editor.width=620
30
+package.editor.x=842
31
+package.editor.y=-883
20 32
 package.frame.height=600
21
-package.frame.width=800
22
-package.numDependencies=2
33
+package.frame.width=746
34
+package.numDependencies=6
23 35
 package.numTargets=13
24 36
 package.showExtends=true
25 37
 package.showUses=true
@@ -37,12 +49,12 @@ target1.width=130
37 49
 target1.x=450
38 50
 target1.y=190
39 51
 target10.height=50
40
-target10.name=Scrabble
52
+target10.name=DepositAccount
41 53
 target10.showInterface=false
42 54
 target10.type=ClassTarget
43
-target10.width=80
44
-target10.x=10
45
-target10.y=250
55
+target10.width=120
56
+target10.x=170
57
+target10.y=120
46 58
 target11.height=50
47 59
 target11.name=TriangleTwo
48 60
 target11.showInterface=false
@@ -65,19 +77,19 @@ target13.width=120
65 77
 target13.x=470
66 78
 target13.y=340
67 79
 target2.height=50
68
-target2.name=Account
80
+target2.name=Calendar1
69 81
 target2.showInterface=false
70 82
 target2.type=ClassTarget
71
-target2.width=80
72
-target2.x=50
73
-target2.y=110
83
+target2.width=90
84
+target2.x=330
85
+target2.y=220
74 86
 target3.height=50
75
-target3.name=Calendar1
87
+target3.name=Account
76 88
 target3.showInterface=false
77 89
 target3.type=ClassTarget
78
-target3.width=90
79
-target3.x=330
80
-target3.y=220
90
+target3.width=80
91
+target3.x=50
92
+target3.y=110
81 93
 target4.height=50
82 94
 target4.name=Squares
83 95
 target4.showInterface=false
@@ -114,9 +126,9 @@ target8.width=80
114 126
 target8.x=350
115 127
 target8.y=290
116 128
 target9.height=50
117
-target9.name=DepositAccount
129
+target9.name=Scrabble
118 130
 target9.showInterface=false
119 131
 target9.type=ClassTarget
120
-target9.width=120
121
-target9.x=170
122
-target9.y=120
132
+target9.width=80
133
+target9.x=10
134
+target9.y=250