Skip to content

Instantly share code, notes, and snippets.

@mauricioaniche
Created May 9, 2019 14:04
Show Gist options
  • Save mauricioaniche/312249471a71dddeeb74991774529b7b to your computer and use it in GitHub Desktop.
Save mauricioaniche/312249471a71dddeeb74991774529b7b to your computer and use it in GitHub Desktop.
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