Write a menu-driven program that completes each task using a recursive function. A shell program is available from your teacher.
letters
that takes a lower case letter as its argument and displays the sequence of letters from 'a' to the given letter.Letters('a');
displays a
and Letters('d');
displays abcd
twos
that takes a single integer as its argument and returns the number of factors of 2 in the number. (Hint: odd numbers have no factors of 2, numbers that are twice an odd number have one, numbers that are four times an odd have two, and so on.) System.out.print(twos(-12)); returns 2
powerof3
that takes a single positive integer argument and returns true iff the integer is a perfect power of 3 such as 1, 3, 9, 27, 81, ...if (powerof3(81)) System.out.println("81 is a power of 3."); else System.out.println("81 is not a power of 3.";displays
81 is a power of 3
reverse
that takes a single long integer argument and returns the result of reversing its digits. For partial credit, write a void function that just displays the number in reverse.System.out.print(reverse(-12)); returns -21
System.out.print(reverse(1234567)); returns 7654321
base5
that takes a single nonnegative integer argument and displays its base five equivalent.base5(136);
displays 1021
base5(5);
displays 10
printWithCommas
that takes a single nonnegative long integer argument and displays it with commas inserted properly.printWithCommas(12045670);
displays 12,045,670
printWithCommas(1);
displays 1