Close BufferedReader

This commit is contained in:
Anthony Wang 2020-08-01 18:03:34 -05:00
parent 25f432f7e1
commit 19675c7f6e
3 changed files with 7 additions and 1 deletions

View file

@ -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);

View file

@ -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) {

View file

@ -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];