Skip to content

Commit a9ee3a8

Browse files
authored
Update BowlerFile.java
1 parent efca0c7 commit a9ee3a8

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

BowlingAlley/code/BowlerFile.java

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,15 @@ class BowlerFile {
3636
*
3737
*/
3838

39-
public static Bowler getBowlerInfo(String nickName)
40-
throws IOException, FileNotFoundException {
39+
public static Bowler getBowlerInfo(String nickName) throws IOException, FileNotFoundException {
4140

4241
BufferedReader in = new BufferedReader(new FileReader(BOWLER_DAT));
4342
String data;
4443
while ((data = in.readLine()) != null) {
4544
// File format is nick\tfname\te-mail
4645
String[] bowler = data.split("\t");
4746
if (nickName.equals(bowler[0])) {
48-
System.out.println(
49-
"Nick: "
50-
+ bowler[0]
51-
+ " Full: "
52-
+ bowler[1]
53-
+ " email: "
54-
+ bowler[2]);
47+
System.out.println("Nick: "+ bowler[0] + " Full: " + bowler[1] + " email: "+ bowler[2]);
5548
return (new Bowler(bowler[0], bowler[1], bowler[2]));
5649
}
5750
}
@@ -68,14 +61,9 @@ public static Bowler getBowlerInfo(String nickName)
6861
*
6962
*/
7063

71-
public static void putBowlerInfo(
72-
String nickName,
73-
String fullName,
74-
String email)
64+
public static void putBowlerInfo(String nickName,String fullName,String email)
7565
throws IOException, FileNotFoundException {
76-
7766
String data = nickName + "\t" + fullName + "\t" + email + "\n";
78-
7967
RandomAccessFile out = new RandomAccessFile(BOWLER_DAT, "rw");
8068
out.skipBytes((int) out.length());
8169
out.writeBytes(data);
@@ -89,11 +77,8 @@ public static void putBowlerInfo(
8977
*
9078
*/
9179

92-
public static Vector getBowlers()
93-
throws IOException, FileNotFoundException {
94-
80+
public static Vector getBowlers()throws IOException, FileNotFoundException {
9581
Vector allBowlers = new Vector();
96-
9782
BufferedReader in = new BufferedReader(new FileReader(BOWLER_DAT));
9883
String data;
9984
while ((data = in.readLine()) != null) {
@@ -105,4 +90,4 @@ public static Vector getBowlers()
10590
return allBowlers;
10691
}
10792

108-
}
93+
}

0 commit comments

Comments
 (0)