All of these must be recursive and cannot use loops. Think about what the base cases are and what the recursive case is.
Below is test code for you to run and verify with the TA for credit for today's lab.
public static void main(String[] args) { R19 rec = new R19(); System.out.println("sumDigits(int x):"); System.out.println("Answer (1234): " + rec.sumDigits(1234) + " Expecting: 10"); System.out.println("Answer (7): " + rec.sumDigits (7) + " Expecting: 7"); System.out.println("Answer (6789): " + rec.sumDigits (6789)); System.out.println(); System.out.println("countCannonballs (int x):"); System.out.println("Answer (1): " + rec.countCannonballs(1) + " Expecting: 1"); System.out.println("Answer: " + rec.countCannonballs (4) + " Expecting: 30"); System.out.println("Answer (10): " + rec.countCannonballs (10)); System.out.println(); System.out.println("numDigits(int x):"); System.out.println("Answer (1234): " + rec.numDigits(1234) + " Expecting: 4"); System.out.println("Answer (7): " + rec.numDigits (7) + " Expecting: 1"); System.out.println("Answer (678900): " + rec.numDigits (678900)); System.out.println(); System.out.println("backString(String s):"); System.out.println("Answer (yes): " + rec.backString("yes")); System.out.println("Answer (): " + rec.backString("")); System.out.println("Answer (a): " + rec.backString("a")); System.out.println("Answer (CS163): " + rec.backString("CS163")); }