Question: Create a single Java class with a main method and the four methods outlined below. The mainline should call each of these methods. A) Write

Create a single Java class with a main method and the four methods outlined below. The mainline should call each of these methods.

A) Write a recursive function that reads a list of integer values, sentinel -1, and prints all multiples of 3. The signature of the function is:

void multipleThree(Scanner in){ }

B) Write a recursive function that takes an integer array as one of its arguments and computes the frequency of the number 0 in the array.

C) Write a recursive function that prints a given positive integer value as its binary equivalent. For example, if the value is 11 the output should be 1011.

D) The recursive function fibSequence() described in the book and in the lectures generates and prints the first n terms in the fibonacci sequence. Re-write this function so that it actually stores the terms in an array of size n, where n is the number of terms required, as it generates them. The signature of this function is:

void fibSequence(int i,int n, int f[]){ }

language java

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!