-
-
Save SDiamante13/0fa49b9d155418bfd9ce1bf7b82623c4 to your computer and use it in GitHub Desktop.
Move Year to production source set (39) Production Code!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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