public class PartOne

public class PartOne{

/** Checks if a number is the sum of three consecutive positive integers

*

* Examples:

* checkForRunOfThree(9) -> true since 2+3+4=9 and 2,3,4>0

* checkForRunOfThree(8) -> false

* checkForRunOfThree(192) -> true since 63+64+65=192

* checkForRunOfThree(3) -> false since 0+1+2=3, but 0 is NOT a positive number

*

* @param number must be a positive integer

* @return true if the input number is the sum of three consecutive positive integers, otherwise false

*/

public static boolean checkForRunOfThree(int number){

return true;

}

/** Finds the FIRST of the three consecutive positive integers that sum to a given number or

* indicates that the number is not the sum of three consecutive positive integers.

*

* Examples:

* RunOfThreeStartingValue(9) -> 2 since 2+3+4=9 and 2,3,4>0

* RunOfThreeStartingValue(8) -> -1 since checkForRunOfThree(8) is false

* RunOfThreeStartingValue(192) -> 63 since 63+64+65=192

* RunOfThreeStartingValue(3) -> -1 since checkForRunOfThree(3) is false

*

* @param number must be a positive integer

* @return the first of three consecutive positive integers that sum to the input number or -1 if the

* number is not the sum of three consecutive positive integers

*/

public static int runOfThreeStartingValue(int number){

return 0;

}

Complete Answer:

Get Instant Help in Homework Asap
Get Instant Help in Homework Asap
Calculate your paper price
Pages (550 words)
Approximate price: -
Open chat
1
Hello 👋
Thank you for choosing our assignment help service!
How can I help you?