Recursion
Purpose
The purpose of thisin-lab is to give you experience with recursion.
Partners
This is an individualassignment, though collaboration (not solution sharing) is allowed.
Preliminaries
Create a BlueJ projectnamed Inlab9 on your lab computer. Place the following filesinto this project:
Driver.java
Recursion.java
Assignment
Complete the followingtwo methods in the Recursion class as described below so that when the programis run, this output is produced. Do not modify the Driverclass at all.
convertToBinary(intnumber)
The method should userecursion to convert a decimal number into its binary equivalent. For example,decimal 4 is equivalent to binary 100.
You may assume that whenthe method is first called, number is greater than or equal to1.
largestArrayItemAuxiliary(int[] numbers, int index)
The method should userecursion to find the largest item stored in an array of integers. The firsttime this method is called, index is 0.
You may assume that thearray always contains at least one item.
Reviews
There are no reviews yet.