Skip to content

Instantly share code, notes, and snippets.

@ssaurel
Created June 16, 2017 11:44
Show Gist options
  • Save ssaurel/a4ddc38eb865f94544cb16b7fd6c1e02 to your computer and use it in GitHub Desktop.
Save ssaurel/a4ddc38eb865f94544cb16b7fd6c1e02 to your computer and use it in GitHub Desktop.
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