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

  Starting hand gesture for the computer

You will develop a webpage that will allow the user to play Rock- Paper- Scissors against the computer.

  Vehicle in vehicle.java

Create a class called Vehicle in Vehicle.java with instance variables make (such as Ford, GM, Chrysler, Toyota, or Honda), year, and horsepower (200, 300, and 400). Add the necessary constructor and set and get methods.

  Represent one book in java

Represent one book in java

  Write a generic class

Write a generic class (using Java generics) called Pair that stores two values of the generic type.  It should have a constructor to set them, two methods getfirst() and getsecond() to retrieve them.

  Debug a program with a jframe

Design, implement, test, and debug a program with a JFrame that allows the user to enter a series of contacts' names, ages, e-mail addresses, and cell phone numbers, and creates a file from the entered data

  How can i maintain a single instance of an object in applet

How can I maintain a single instance of an object in an applet? What is UDP and how does it work?

  Write java program to read in sequence of hourly temperature

Write down Java program which reads in sequence of hourly temperature readings over 24-hour period using arrays. Your program must find and show maximum and minimum temperatures.

  Design an object-oriented java application

You are to design an object-oriented Java application to let the user play a dice game that uses two dices. The player bets on a value and the dices roll

  Write following java expressions in mathematical notation

Write the following Java expressions in mathematical notation.

  Write a mathematical recursive definition

Write a mathematical, recursive definition of p(n) - Prove that your answer to Part a is correct by using mathematical induction.

  What is a java archive

What type of output does the javadoc command generate and how do you view the output and what is a Java archive?

  Explain polymorphism

Explain polymorphism. Do all programming languages have polymorphism, and why or why not? Why is it useful and identify situations where polymorphic behavior would be absolutely necessary

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