/** Static Factory Constructor */ public static BrainyNumber from(int n) { return new BrainyNumber(n); }
//Example Usage BrainyNumber bn = new BrainyNumber(6); prn("tripled -- 6: " + bn.tripled()); //tripled -- 6: 18
public String toString() { return String.format("BrainyNumber(%d)", this.myNumber); }
//Example Usage BrainyNumber bn = new BrainyNumber(11); prn("BrainyNumber is: " + bn.getMyNumber()); //Output should be: // BrainyNumber is: 11
//Example Usage BrainyNumber bn = new BrainyNumber(12); prn("Is BrainyNumber greater than 5: " + bn.isGreaterThan(5)); //Output should report true
BrainyNumber bn = new BrainyNumber(6); prn("tripled -- 6: " + bn.tripled()); //tripled -- 6: 18
//Example Usage BrainyNumber bn = new BrainyNumber(15); prn("EasilyDivisible -- 15: " + bn.isEasilyDivisible()); //EasilyDivisible -- 15: true bn = new BrainyNumber(11); prn("EasilyDivisible -- 11: " + bn.isEasilyDivisible()); //EasilyDivisible -- 11: true
Example: What is the abcFactor of the number 15? Answer: abcFactor is 8 (using the given computation steps) Example: What is the abcFactor of the number 1? Answer: abcFactor is 1 (using the given computation steps)
Example: base (my number) = 2 exponent (param) = 5 Answer power = 2 * 2 * 2 * 2 * 2 = 32
Example: my number = 5 Answer sum = 1 + 2 + 3 + 4 = 10;