Skip to content

Instantly share code, notes, and snippets.

@SDiamante13
Created July 27, 2022 21:16
Show Gist options
  • Select an option

  • Save SDiamante13/0fa49b9d155418bfd9ce1bf7b82623c4 to your computer and use it in GitHub Desktop.

Select an option

Save SDiamante13/0fa49b9d155418bfd9ce1bf7b82623c4 to your computer and use it in GitHub Desktop.
Move Year to production source set (39) Production Code!
package tech.pathtoprogramming.tdd;
class Year {
private int year;
public Year(int year) {
this.year = year;
}
public boolean isLeapYear() {
return isDivisibleBy(4)
&& (isNotDivisibleBy(100)
|| isDivisibleBy(400));
}
private boolean isDivisibleBy(int number) {
return this.year % number == 0;
}
private boolean isNotDivisibleBy(int number) {
return this.year % number != 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment