September 2019
Intermediate to advanced
816 pages
18h 47m
English
Let's follow the same flow from the previous problem. So, this time, the Function class will look as follows:
public class Function { private final int n; public Function(int n) { this.n = n; } public int yMinusX(int x, int y) { return y - x; }}
Notice that the preceding snippet of code doesn't assume any range restrictions over x, y, and n. Now, let's impose the following ranges:
These ranges can be imposed in code via the if statements as follows:
public class Function { private static final int N_UPPER_BOUND = ...