Last active
June 16, 2017 11:43
-
-
Save ssaurel/4e2008017a635952c5903ff881a9a78e to your computer and use it in GitHub Desktop.
Subtract Operation for the Countdown Math Game on the SSaurel's Channel
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 com.ssaurel.countdowngame; | |
public class Subtract implements Operation { | |
@Override | |
public int eval(int x, int y) { | |
if (x < y) { | |
return y - x; | |
} else { | |
return x - y; | |
} | |
} | |
@Override | |
public String symbol() { | |
return "-"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment