-
-
Save mauricioaniche/312249471a71dddeeb74991774529b7b to your computer and use it in GitHub Desktop.
This file contains 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 tudelft.sqt.mocks; | |
import java.util.Calendar; | |
public class ChristmasDiscount { | |
public double discount(double value) { | |
Calendar today = Calendar.getInstance(); | |
boolean isDecember = today.get(Calendar.MONTH) == Calendar.DECEMBER; | |
boolean isTwentyFifth = today.get(Calendar.DAY_OF_MONTH) == 25; | |
boolean isChristmas = isDecember && isTwentyFifth; | |
return isChristmas ? value * 0.10 : 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment