Design and implement a recursive method


Java- Data Structures and Analysis

Prefered Netbeans

Question 1

a) Design and implement a recursive method convert1 which takes two parameters: a positive integer number n (in base 10) and a positive integer number b between 2 and 9 inclusively. The method should return the number in base b which corresponds to the decimal number n. For example, convert1(19, 8) should return 23. It means that 19 in base 10 correspond to 23 in base 8. Hint. Note that n / 10 is an integer obtained by dropping the rightmost digit of n while n % 10 is the rightmost digit of n.

b) Design and implement a recursive method convert2 which takes two parameters: an integer b between 2 and 9 and a String n representing a numeric value in base b. The method should return an int value representing the decimal value of n. For example convert2 ("11101", 2) should return 29.

c) Design and implement TestQ1.java a Swing based GUI driver program to test the methods convert1 and convert2.

Question 2

Consider an array of size 20 fully populated with non-duplicated, random generated, unsorted integer values in the range -99..99.

a) Design and implement a recursive method findValueUnsortedArray which takes two parameters: an unsorted array of integer values and an integer value which is looked for in the array. The method returns the array index of the value being searched for if the value is in the array and -1 if the value is not in the array. The method should be splitting the array in two halves looking for the value in each of the two halves and so on ... until it gets to individual values that can be compared to the value which is searched for.

b) Using the Binary Search Method, design and implement a recursive method findValueSortedArray with the same signature and return value as the method findValueUnsortedArray.

c) What is the Big-O complexity of the two methods? Explain why they are different.

d) Design and implement TestQ2.java a driver program to test the methods findValueUnsortedArray and findValueSortedArray. Consider an array of size 20 initially populated with non-duplicated integer values.

Submission requirements

Submit the following before the due date listed in the Calendar:

1. The source files TestQ1.java and TestQ2.java. These source files should also include the required recursive methods. The source code should use Java code conventions and professional code layout regarding white space management, indents and comments.

2. The Solution description document _HW3 (.pdf or .doc / .docx) containing: (2.1) assumptions, main design decisions, error handling; (2.2) test cases and two relevant screenshots; (2.3) the answer and explanation required by question 2c); (2.4) lessons learned and (2.5) possible improvements. The size of the document file (including the screenshots) should be of two pages, single spaced, font size 10.

Requirements:

Design:

Employs Modularity (including proper use of parameters, use of local variables etc.) most of the time.

Employs correct & appropriate use of programming structures (loops, conditionals, classes etc.) most of the time.

Efficient algorithms used most of the time.

Excellent use of object-oriented design.

Functionality:

Program fulfills all functionality.

All requirements were fulfilled.

Extra effort was apparent.

Test Plan:

Comprehensive test plan.

Documentation:

Excellent comments.

Comprehensive lessons learned.

Excellent possible improvements included.

Excellent approach discussion and references.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Design and implement a recursive method
Reference No:- TGS01472308

Expected delivery within 24 Hours