sequence2and
sequence3according to the pre and post-conditions.
Both 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) { R17 rec = new R17(); System.out.println("pracSeq1(int x):"); System.out.println("Answer: " + rec.pracSeq1(5) + " Expecting: 32"); System.out.println("Answer: " + rec.pracSeq1(7) + " Expecting: 128\n"); System.out.println("sequence(int x):"); System.out.println("Answer: " + rec.sequence2(4) + " Expecting: 11"); System.out.println("Answer: " + rec.sequence2(5) + " Expecting: 20\n"); System.out.println("sequence3:"); System.out.println("Answer: " + rec.sequence3(2) + " Expecting: 7"); System.out.println("Answer: " + rec.sequence3(3) + " Expecting: 20"); System.out.println("Answer: " + rec.sequence3(6) + " Expecting: 547\n"); }