Created
June 16, 2017 11:44
-
-
Save ssaurel/a4ddc38eb865f94544cb16b7fd6c1e02 to your computer and use it in GitHub Desktop.
Divide 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 Divide implements Operation { | |
@Override | |
public int eval(int x, int y) { | |
if (x < y) { | |
int t = x; | |
x = y; | |
y = t; | |
} | |
if (x % y == 0) { | |
return x / y; | |
} else { | |
return 0; | |
} | |
} | |
@Override | |
public String symbol() { | |
return "/"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment