Lab 9: Recursion

Due: Wednesday 27th at 10 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 Lab9 on your lab computer. Create the following class in this project:

Tasks

Complete the following two methods in the Lab9 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 Lab11 class.

Submission

Due on Wednesday 10pm. Can be either checked off by the instructor or upload into dropbox on D2L and .java files only.