Skip to content

Commit 531301b

Browse files
authored
Adding analyzer feedback to design.md for bird watcher concept exercise (#2695)
* Adding analyzer feedback to design.md for bird watcher concept exercise * Applying suggestions Adding celebratory comment Updating analyzer comments to require the user to implement a for and for-each loop Updating reference resolution
1 parent cde57b5 commit 531301b

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

exercises/concept/bird-watcher/.meta/design.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,17 @@ This exercise's prerequisites Concepts are:
3636
- `classes`: know how to work with fields.
3737
- `booleans`: know what a `boolean` is.
3838
- `basics`: know how to work with `integers` and how to assign and update variables.
39+
40+
## Analyzer
41+
42+
This exercise could benefit from the following rules in the [analyzer]:
43+
44+
- `essential`: Verify that the solution does not hard-code the array passed in the constructor of the class `{2, 5, 0, 7, 4, 1 }`.
45+
- `essential`: The solution requires that the user uses at least once a `For` loop, the method `getCountForFirstDays()` could be a great place to do it.
46+
- `essential`: The solution requires that the user uses at least once a `For-Each` loop, the method `getBusyDays()` could be a great place to do it.
47+
- `actionable`: If the student did not use `clone` in the constructor to make a copy of the array, instruct them to do so. This is because if not, allows code outside the class to mutate the contents of the array.
48+
49+
If the solution does not receive any of the above feedback, it must be exemplar.
50+
Leave a `celebratory` comment to celebrate the success!
51+
52+
[analyzer]: https://github.com/exercism/java-analyzer

exercises/concept/bird-watcher/.meta/src/reference/java/BirdWatcher.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ public BirdWatcher(int[] birdsPerDay) {
77
}
88

99
public int[] getLastWeek() {
10-
return birdsPerDay.clone();
10+
return new int[] { 0, 2, 5, 3, 7, 8, 4 };
1111
}
1212

1313
public int getToday() {
1414
return birdsPerDay[birdsPerDay.length - 1];
1515
}
1616

1717
public void incrementTodaysCount() {
18-
birdsPerDay[birdsPerDay.length - 1] = birdsPerDay[birdsPerDay.length - 1] + 1;
18+
birdsPerDay[birdsPerDay.length - 1]++;
1919
}
2020

2121
public boolean hasDayWithoutBirds() {

0 commit comments

Comments
 (0)