diff options
author | Anthony Wang | 2020-08-01 18:03:34 -0500 |
---|---|---|
committer | Anthony Wang | 2020-08-01 18:03:34 -0500 |
commit | 19675c7f6e4102d819fbd1f375d06ded0b4afdbf (patch) | |
tree | b02b51e4814aef0756fa9937ff78cf0ac8b6aee8 | |
parent | 25f432f7e145f573c9bb05951b3f8c0a0119cb76 (diff) |
Close BufferedReader
-rw-r--r-- | billboard.java | 2 | ||||
-rw-r--r-- | measurement.java | 4 | ||||
-rw-r--r-- | shuffle.java | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/billboard.java b/billboard.java index 0ba1744..21c8ad0 100644 --- a/billboard.java +++ b/billboard.java @@ -26,6 +26,8 @@ public class billboard { int y5 = Integer.parseInt(st.nextToken()); int x6 = Integer.parseInt(st.nextToken()); int y6 = Integer.parseInt(st.nextToken()); + + br.close(); // the visible area is the sum of the visible area of the first billboard and the second billboard int combinedArea = visibleArea(x1, y1, x2, y2, x5, y5, x6, y6) + visibleArea(x3, y3, x4, y4, x5, y5, x6, y6); diff --git a/measurement.java b/measurement.java index 9557a5f..1883987 100644 --- a/measurement.java +++ b/measurement.java @@ -17,6 +17,8 @@ public class measurement { cow[i] = st.nextToken(); change[i] = Integer.parseInt(st.nextToken()); } + + br.close(); // the milk variables track the amount of milk that each cows was last known to produce int bessieMilk = 7, elsieMilk = 7, mildredMilk = 7; @@ -41,7 +43,7 @@ public class measurement { } // compute the highest milk total and see which cows produced the most milk int highestMilk = Math.max(bessieMilk, Math.max(elsieMilk, mildredMilk)); - boolean bessieOnNext = bessieMilk == highestMilk; + boolean bessieOnNext = (bessieMilk == highestMilk); boolean elsieOnNext = elsieMilk == highestMilk; boolean mildredOnNext = mildredMilk == highestMilk; if(bessieOn != bessieOnNext || elsieOn != elsieOnNext || mildredOn != mildredOnNext) { diff --git a/shuffle.java b/shuffle.java index 70f66a3..bcabaf8 100644 --- a/shuffle.java +++ b/shuffle.java @@ -27,6 +27,8 @@ public class shuffle { for(int i = 1; i <= n; i++) { finalLocs[i] = Integer.parseInt(st.nextToken()); } + + br.close(); // allocate an array to store the original locations of all cows int[] originalLocations = new int[n+1]; |