Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Someone did answer these questions but the following errors occurred: ant -f C:UsersplaplaDocumentsNetBeansProjectsCommonArrayAlgorithmsApp -Dnb.internal.action.name=run run init: Deleting: C:UsersplaplaDocumentsNetBeansProjectsCommonArrayAlgorithmsAppuilduilt-jar.properties deps-jar: Updating property file: C:UsersplaplaDocumentsNetBeansProjectsCommonArrayAlgorithmsAppuilduilt-jar.properties Compiling 1

image text in transcribed

Someone did answer these questions but the following errors occurred:

ant -f C:\Users\plapla\Documents\NetBeansProjects\CommonArrayAlgorithmsApp -Dnb.internal.action.name=run run init: Deleting: C:UsersplaplaDocumentsNetBeansProjectsCommonArrayAlgorithmsAppuilduilt-jar.properties deps-jar: Updating property file: C:UsersplaplaDocumentsNetBeansProjectsCommonArrayAlgorithmsAppuilduilt-jar.properties Compiling 1 source file to C:UsersplaplaDocumentsNetBeansProjectsCommonArrayAlgorithmsAppuildclasses C:UsersplaplaDocumentsNetBeansProjectsCommonArrayAlgorithmsAppsrccommonarrayalgorithmsappCommonArrayAlgorithmsTester.java:57: error: incompatible types: boolean cannot be converted to int arraySearchValue = CommonArrayAlgorithms.arraySearch(testArray1, 445); C:UsersplaplaDocumentsNetBeansProjectsCommonArrayAlgorithmsAppsrccommonarrayalgorithmsappCommonArrayAlgorithmsTester.java:60: error: incompatible types: boolean cannot be converted to int arraySearchValue = CommonArrayAlgorithms.arraySearch(testArray2, 445); 2 errors C:UsersplaplaDocumentsNetBeansProjectsCommonArrayAlgorithmsApp bprojectuild-impl.xml:930: The following error occurred while executing this line: C:UsersplaplaDocumentsNetBeansProjectsCommonArrayAlgorithmsApp bprojectuild-impl.xml:270: Compile failed; see the compiler error output for details. BUILD FAILED (total time: 0 seconds)

CS136: Computer Science Il -Spring 2019 Question 2: Common Array Algorithms [28 points] In this problem, you will implement 7 common array algorithms in Java. Each algorithm will be coded as a single method in the class CommonArravAlgorithms. Begin by importing the provided ZIP file to NetBeans (File Import Project From ZIP). This project has one class (CommonArrayAlgorithmsTester) ch s designed totest the class CommonArrayAlgorithms that you will implement. Next, add a CommonArrayAlgorithms class to the package commonarrayalgorithmsapp sure that your code passes all tests Then, implement the seven methods described below. Make Hint: Study the methods in the class CommonArrayAlgorithmsTesterbefore implementing the methods of CommonArrayAlgorithms as they will provide hints about the methods input and output data types. 1. The method arrayToString receives an array of integers and returns a string that contains all the values in the array separated with pipes. For example, if the input array is f5, 9, 1, 12, -2, 0], the output should be the string "5 9|1|12|-2 0". If the array has one element, the string should have that element and no pipes 2. The method arraySum receives an array of integers and returns the summation of the values in this array The method arrayAvg receives an array of integers and returns the average of the values in this array. You can assume that the input array has at least one element 3. 4. The method arrayMax returns the value of the largest element in an input integer array 5. The arraySearch method receives two inputs: an array of integers and an integer value. It returns the index of this value in the array. If the value is not in the array, arraySearch returns -1 The method arraySwap has three parameters: an array of integers and two indices. It swaps the value at the first index with the value at the second index. If the swap was successful, true is returned otherwise false is returned. A swap fails if any of the two indices is less than 0 or larger than or equal to the array size. 6. 7. The method arrayGrowDouble gets an array of integers and returns an array of integers that is double the size of the input array. All the values in the input array are also copied to the output array

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions