Skip to content

Instantly share code, notes, and snippets.

@BetterProgramming
Created May 13, 2019 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BetterProgramming/65cd4ec01da31dd230d0bc35ae941f85 to your computer and use it in GitHub Desktop.
Save BetterProgramming/65cd4ec01da31dd230d0bc35ae941f85 to your computer and use it in GitHub Desktop.
// see repo for full code
boolean milk;
boolean soy;
boolean mocha;
boolean whip;
// and their getters and setters
public int cost() {
int total = 0;
if (isMilk()) {
total += MILK_COST;
}
if (isSoy()) {
total += SOY_COST;
}
if (isMocha()) {
total += MOCHA_COST;
}
if (isWhip()) {
total += WHIP_COST;
}
return total;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment