Write a full java program to conduct linear search and binary search using. This program is...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a full java program to conduct linear search and binary search using. This program is expected to use four functions and the main method to run your code and print the results. 1- Function fillArrayFromFile() This void function is expected to read all the integer numbers from the attached file "UniqueIntegers.txt" and store them in a traditional array. 2- Function sortArray(int[] numbers) This function is expected to sort the numbers in the array in an ascending way (from the smallest to the highest). Note: for sorting the array, you can use either selection sort or insertion sort 3- Function linearSearch(int[] numbes, int key) Using linear Search concepts, this function is expected to receive the array and a key value of type integer and return true if the key is existed in the array or return false if the key does not exist. 4- Function binarySearch(int[] numbers, int key) Using binary Search concepts, this function is expected to receive the array and a key value of type integer and return true if the key is existed in the array or return false if the key does not exist. Part II (10 Points) : 1- Apply java coding style. 2- Conduct a Junit test to test your functions. 3- Use a JavaDoc for generating documentation. 4- Use a try-catch() statement to ensure the code will not get crash. Write a full java program to conduct linear search and binary search using. This program is expected to use four functions and the main method to run your code and print the results. 1- Function fillArrayFromFile() This void function is expected to read all the integer numbers from the attached file "UniqueIntegers.txt" and store them in a traditional array. 2- Function sortArray(int[] numbers) This function is expected to sort the numbers in the array in an ascending way (from the smallest to the highest). Note: for sorting the array, you can use either selection sort or insertion sort 3- Function linearSearch(int[] numbes, int key) Using linear Search concepts, this function is expected to receive the array and a key value of type integer and return true if the key is existed in the array or return false if the key does not exist. 4- Function binarySearch(int[] numbers, int key) Using binary Search concepts, this function is expected to receive the array and a key value of type integer and return true if the key is existed in the array or return false if the key does not exist. Part II (10 Points) : 1- Apply java coding style. 2- Conduct a Junit test to test your functions. 3- Use a JavaDoc for generating documentation. 4- Use a try-catch() statement to ensure the code will not get crash.
Expert Answer:
Answer rating: 100% (QA)
Heres a breakdown of what a Java program following the requirements in your question would look like Unfortunately without the actual file UniqueInteg... View the full answer
Related Book For
Principles Of Information Security
ISBN: 9780357506431
7th Edition
Authors: Michael E. Whitman, Herbert J. Mattord
Posted Date:
Students also viewed these finance questions
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
Growth Strategy A. Organic Growth This section describes how JB Hi-Fi Australia can take advantage of various organic growth strategies, including new product development, market development and...
-
A 1.50-kg iron horseshoe initially at 600C is dropped into a bucket containing 20.0 kg of water at 25.0C. What is the final temperature? (Ignore the heat capacity of the container, and assume that a...
-
Solve the given problems involving factorials. Show that n! = n (n 1)! for n 2. To use this equation for n = 1, explain why it is necessary to define 0! = 1 (this is a standard definition of 0!).
-
All ferromagnetic materials have a Curie temperature, a temperature above which they will cease to be magnetic. Explain in some detail why you might expect this to be so.
-
William Evans began Evans Distributors, a sporting goods distribution company, in January 2016, and engaged in the transactions below. Assume Evans Distributors and its customers take advantage of...
-
The firm has $0.500 billion in outstanding debt. Its total value is $2 billion. Its cost of debt (rd) is 8% and its cost of equity is (re) is 12%.What is its weighted average cost of capital (WACC)...
-
A venturi meter similar to the one in Fig. 15.2 is attached to a 4-in Schedule 40 steel pipe and has a throat diameter of 1.50 in. Determine the pressure difference across the meter that would be...
-
PanPac Shipping is considering replacing an existing ship with a newer and more efficient one for a 5-year contract of affreightment. The existing ship is five years old; it cost $32 million and is...
-
Consider the following Markov chain: 1 1/2 S 1/2 S. 2 C 1/4 1/4 S 3 1/2 1/2 S 4 1/3 1/3 1/3 1/2 1 S 5 So Given that the above process is in state So just before the first trial, determine by...
-
Your client buys ABC stock for $70. One year later ABC has paid $20 in dividends and your client decides to sell when the stock is at $130. Calculate your clients Holding Period Return.
-
Imagine an experiment where you measure the width, length and height of a box, in centimeters. Additionally, you estimate an uncertainty (error) in each measurement. The goal is to calculate the...
-
Most of the claims the insurance (firms/firm's) processed after the partial mine collapse were categorized as (Worker/Workers') Compensation. Question 10 options: firms ... Worker firms ... Workers'...
-
AAA corp. has announced that they are going to pay $0.34 dividend next year for the first time. The dividends grows at 40% for the next four years and 4% annually thereafter. If the equity holders...
-
JJ Company issued an 8%, P8,400,000 bonds at 120 on January 1, 2019. Interest on these bonds is paid every June 30 and December 31. Moreover, bonds mature every December 31 at the following rates:...
-
On average there are four traffic accidents in a city during one hour of rush-hour traffic. Use the Poisson distribution to calculate the probability that in one such hour there arc (a) No accidents...
-
I. Justify the purpose and reasoning why this IDPS extension is beneficial to have available when detecting possible intrusions that have come into a system. II. Recall that stateful protocol...
-
Recognize that when a characteristic of information changes, the value of that information may increase but more so decreases. Comprehend and define the following security terms and concepts:...
-
True or False: Cyberterrorism has thus far been largely limited to acts such as the defacement of NATO Web pages during the war in Kosovo.
-
Find the modified \(z\)-transform of the following functions: (a) \(E(s)=\frac{6}{(s+1)(s+2)(s+3)}\) (b) \(E(s)=\frac{4}{s(s+2)^{2}}\) (c) \(E(s)=\frac{s^{2}+2 s+2}{s(s+2)^{2}}\) (d)...
-
Consider again the system of Fig. P4.4-5. Add a sampler for \(E(s)\) at the input. Given \[ G_{1}(s)=\frac{1}{s+10} \quad D(z)=\frac{z-0.5}{z-1} \quad G_{2}(s)=\frac{s}{s^{2}+9 s+23} \] find \(c(k...
-
The model of a continuous-time system with algebraic loops is given as \[ \begin{aligned} \dot{x}_{1}(t) & =-x_{1}(t)+2 \dot{x}_{2}(t)+u_{1}(t) \\ \dot{x}_{2}(t) &...
Study smarter with the SolutionInn App