Skip to content

Commit

Permalink
Adding analyzer feedback to design.md for bird watcher concept exerci…
Browse files Browse the repository at this point in the history
…se (#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
  • Loading branch information
manumafe98 authored Jan 31, 2024
1 parent cde57b5 commit 531301b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions exercises/concept/bird-watcher/.meta/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,17 @@ This exercise's prerequisites Concepts are:
- `classes`: know how to work with fields.
- `booleans`: know what a `boolean` is.
- `basics`: know how to work with `integers` and how to assign and update variables.

## Analyzer

This exercise could benefit from the following rules in the [analyzer]:

- `essential`: Verify that the solution does not hard-code the array passed in the constructor of the class `{2, 5, 0, 7, 4, 1 }`.
- `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.
- `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.
- `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.

If the solution does not receive any of the above feedback, it must be exemplar.
Leave a `celebratory` comment to celebrate the success!

[analyzer]: https://github.com/exercism/java-analyzer
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ public BirdWatcher(int[] birdsPerDay) {
}

public int[] getLastWeek() {
return birdsPerDay.clone();
return new int[] { 0, 2, 5, 3, 7, 8, 4 };
}

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

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

public boolean hasDayWithoutBirds() {
Expand Down

0 comments on commit 531301b

Please sign in to comment.