Section9Key 3 - r U. One possible public rf solution...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: r U. One possible public rf solution appears be.Low. void printRange (int y) { x, int (x > y) { throw new Illegal-ArgumentException (x ) else if Y) { System. out . print (x) ; ) eLse j-f (x + 1:: Y) { + ?r - 'r + y); System.out.print(x I , aslvq a v v () ; + tr > "); System.out.print(x printRange (x + !, y 1); (" < w + y) ; System. out.print It I ) 11. One possible public if solution appears below. int evens (int n) { (n -evens (-n); return (n else if 0) return 0; (n * 2 else if 0) return 10 * evens(n / eI se return evens (n / LO) ; solution appears LO) + n t 10; ) L2. One possible public if bel-ow. (int void writeSquares n) { (n throw new IllegalArgumentException (n el-se if 1) (1); System.out.print (n * 2 else if 1) { * n 1 ", "); System.out.print(n (n writeSquares 1); ) el-se { (n writeSquares 1); System.out.print(", " + n * n); ) soJ-ution appears below. () ; ) 13. One possible public if void writeSequence (int n) i (n throw new IllegalArgumentException (n :: el-se if 1) (1) ; System. out.print (n else if 2) ("1 1") ; System.out.print pl qo I () ; int number : (n + 1) / 2; (number + r' " ) ; System. out.print writeSequence (n 2) ; System.out.print(" " + number); ) ) ...
View Full Document

Ask a homework question - tutors are online