Inlab 9: Recursion

Due: Friday 8 April at 6 pm

Purpose

The purpose of this in-lab is to give you experience with recursion.

Partners

This is an individual assignment, though collaboration (not solution sharing) is allowed.

Preliminaries

Create a BlueJ project named Inlab9 on your lab computer. Place the following files into this project:

Assignment

Complete the following two methods in the Recursion class as described below so that when the program is run, this output is produced. Do not modify the Driver class at all.

convertToBinary(int number)

The method should use recursion to convert a decimal number into its binary equivalent. For example, decimal 4 is equivalent to binary 100.

You may assume that when the method is first called, number is greater than or equal to 1.

largestArrayItemAuxiliary(int [] numbers, int index)

The method should use recursion to find the largest item stored in an array of integers. The first time this method is called, index is 0.

You may assume that the array always contains at least one item.

Grading - 10 points possible

Note: only make changes to the above two methods. Do not change anything else in the Recursion class.

Submission

By Friday 8 April at 6 pm, submit the file Recursion.java into the appropriate D2L dropbox folder. DO NOT SUBMIT .class files.