Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Divide Operation for the Countdown Math Game on the SSaurel's Channel
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