Question: Please pass the codecheck for both https://codecheck.it/files/18100619014vzj1koa8ua6w53dy0i56pil8 https://codecheck.it/files/1810061902aej4bdgjv8o0p55rtqyix1obd public class A { /** * A. Write the function named nearHundred(). * * Given an int
Please pass the codecheck for both
https://codecheck.it/files/18100619014vzj1koa8ua6w53dy0i56pil8
https://codecheck.it/files/1810061902aej4bdgjv8o0p55rtqyix1obd
public class A { /** * A. Write the function named nearHundred(). * * Given an int n, return true if it is within * 10 of 100 or 200. Note Math.abs(n) returns the * absolute value of a number. * * For instance: * nearHundred(93) returns true * nearHundred(90) returns true * nearHundred(89) returns false * * @param n is the int passed as a parameter. * @return true if n is within 10 of 100 or 10 of 200. */ // TODO - Write the nearHundred method here /** * B. Write the method redTicket(). * * You have a red lottery ticket showing ints * a, b, and c, each of which is 0, 1, or 2. * If all of the numbers have the value 2, * then the payout is 10. Otherwise, if they * are all the same, the payout is 5. Otherwise, * so long as both b and c are different from a, * then the payout is 1. Otherwise, the payout is 0. * * Examples: * redTicket(2, 2, 2) returns 10 * redTicket(2, 2, 1) returns 0 * redTicket(0, 0, 0) returns 5 * * @param a first number on the ticket. * @param b second number on the ticket. * @param c third number on the ticket. * @return payout (integer) as described above. */ // TODO - Write the redTicket method here. /** * C. Write the in1To10() method here. * * Given a number n, return true if n is in the * range 1..10, inclusive. Unless "outsideMode" is * true, in which case return true if the number * is less or equal to 1, or greater or equal to 10. * * Examples: * in1To10(5, false) returns true * in1To10(11, false) returns false * in1To10(11, true) returns true * * @param n the number to compare. * @param outsideMode if true, change the way the calculation is done. * @return true if n meets the conditions above. */ // TODO - Write the method in1To10 here. }
public class B { /** * Write the method named evenlySpaced(). * * Given three ints, a b c, one of them is small, * one is medium and one is large. Return true if * the three values are evenly spaced, so the * difference between small and medium is the * same as the difference between medium and large. * * Examples: * evenlySpaced(2, 4, 6) returns true * evenlySpaced(4, 6, 2) returns true * evenlySpaced(4, 6, 3) returns false * * @param a the first number. * @param b the second number. * @param c the third number * @return true if the numbers meet the conditions described. */ // TODO - Write the evenlySpaced method here. /** * Write the method named luckySum(). * * Given 3 int values, a b c, return their sum. * However, if one of the values is 13 then it * does not count towards the sum and values * to its right do not count. So for example, * if b is 13, then both b and c do not count. * * Examples: * luckySum(1, 2, 3) returns 6 * luckySum(1, 2, 13) returns 3 * luckySum(1, 13, 3) returns 1 * * @param a the first number. * @param b the second number. * @param c the third number * @return the lucky sum as calculated here. */ // TODO - Write the luckySum method here. /** * Write the method named makeBricks(). * * We want to make a row of bricks that is goal * inches long. We have a number of small bricks * (1 inch each) and big bricks (5 inches each). * Return true if it is possible to make the * goal by choosing from the given bricks. * * Examples: * makeBricks(3, 1, 8) returns true * makeBricks(3, 1, 9) returns false * makeBricks(3, 2, 10) returns true * * @param small number of small bricks. * @param big number of big bricks. * @param goal number of bricks desired in row. * @return true if possible with available bricks. */ // TODO - Write the makeBricks method here }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
