代写代考 COMP1110 Final Exam, Question 1.2 (harder)

package comp1110.exam;

* COMP1110 Final Exam, Question 1.2 (harder)
public class Q1TwoThree {

Copyright By PowCoder代写 加微信 powcoder

* Given a string, return true if the string represents a twothree number,
* or false otherwise.
* A twothree number is recursively defined as an integer that is divisible
* by either two or three AND the left n – 1 most digits of the number are
* also a twothree number.
* So for example, 6 is a twothree number, and 62 is a twothree number since
* 62 is divisible by 2 and the left n – 1 digits are ‘6’, which is also
* a twothree number. 22222 is a twothree number. 267 is a
* twothree number but 265 is not since 265 is not divisible by 2 or 3. 2652
* is not a twothree number because 265 is not a twothree number. 0 is not
* a two-three number.
* An empty string or a string with anything other than a digit from 0-9 is
* not a twothree number.
* @param number A number
* @return true if number is a twothree number as defined above.
public static boolean twothree(String number) {
return true; // FIXME complete this method

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com