Design and implement recursive method findvalueunsortedarray

Assignment Help JAVA Programming
Reference no: EM131094269

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 <YourSecondName>_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.

Reference no: EM131094269

Questions Cloud

Will carter have to do so and is that fair : When the best offer she got for the desk was $2,500, Baker returned the desk to Carter. Baker told Carter that Ames had exceeded his authority in purchasing the desk, and she demanded that Carter refund the $3,000 that Ames had paid for the desk. ..
Impervious to terrorist attack or natural disasters : Past events have shown us that we are not impervious to terrorist attack or natural disasters. There have been many times in history that we have failed in vigilance and taken a lackadaisical approach.
Approximate probability that in a random sample : What is the approximate probability that in a random sample of 75 Black Friday shoppers, there will be 19 or more people who will camp out in front of a store?
Specified volume of absorption : The paper towels have a normal distribution with a mean of 49.5 ml and a standard deviation of 4.3 . If 3% of the paper towels exceed a specified volume of absorption of a, what is the value of a?
Design and implement recursive method findvalueunsortedarray : 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.
Should the case be transferred to a south carolina venue : In this case, however, the studios objected when CleanFlicks edited the films and sold the altered versions directly to consumers. Similarly, CleanFlicks made unauthorized copies of the studios' DVDs to edit the films, but objected when others mad..
Problem regarding the volunteer work : What is the probability of randomly sampling 145 women 16 years of age or older and getting 35 or more who do volunteer work?
Differences in the relationships between wealth and income : Discuss differences in the relationships between wealth and income. For example, how might the wealth and income levels of the elderly be different from those of younger individuals who only recently entered the labor force?
Time lapsed between two consecutive trades : The probability that the time lapsed between two consecutive trades would fall below 13 seconds was 7%. What is the probability that the time lapsed between two consecutive trades will be longer than 17 seconds?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write a program using bucket sort idea to create histograms

The input data are in an external file named election.txt. The first line is an integer N representing the number of candidates. The next N lines are the names of the canditates.

  Write a method insert at that takes an array of integers

Write a method, insertAt, that takes four parameters: an array of integers; the length of the array; an integer, say, insertItem; and an integer, say, index

  Calculates the area of a triangle

Write a simple Java application which calculates the area of a triangle. Your application should ask the user to enter the base and height values of the triangle.

  Develop a java gui application using layout managers

COIT11134Object Oriented Programming - Develop a Java GUI application using layout managers and develop an application that uses two or more classes.

  Write the syntax of while statement and

Write the syntax of while Statement and explain with an example. What is Nested loop write an example of nested loops using for loop? What is an index? What are the bounds of an array or array list? What is a bounds error

  Calculator for elementary school children

Write a program that is designed as a calculator for elementary school children. It will calculate addition, subtraction, multiplication, and division.

  Write a method called alldigitsodds that returns whether

write a method called alldigitsodds that returns whether every digit of a positive integer is odd. return true if the

  Write program in java for total amount of customer-s order

Write down program in Java which would ask for clerk to enter total amount of customer's order. Program will then compute seven percent (7%) sales tax.

  Specify, design and implement a class

Specify, design and implement a class that can be used to hold information about a musical note. Test it with an appropriate driver program.

  Determine whether a given credit card number is valid or not

Implement Luhn's algorithm in a program to determine whether a given credit card number is valid or not. You must test if the number of digits in the input is in the valid range (13 to 16), run Luhn's algorithm to test its validity.

  Write down a java application which inputs three integers

write a java application that inputs three integers from the user and displays the sum average product smallest and

  Design the class line type to store a line

Design the class lineType to store aline. To store a line, you need to store the values of a (coefficient of x), b(coefficient of y), and c. Your class must contain the following operations.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd