Answered step by step
Verified Expert Solution
Question
1 Approved Answer
P 2 - ArrayEditor [ 1 0 points ] The attached ArrayEditor program initializes the TenNumbers array with ten random integers. Begin by importing the
P ArrayEditor points The attached ArrayEditor program initializes the TenNumbers array with ten random integers. Begin by importing the ArrayEditor project to NetBeans. Next, modify the methods in this program so that the program prints four lines of output, containing: All elements in the TenNumbers array. The contents of TenNumbers, after swapping the first and last elements in the array The contents of enNumbers, after replacing all even elements with The largest value in TenNumbers. The provided seed code has four method declarations: The getAllElements method receives an input array of integers and returns a String with all the values in the array. The swapFirstLast method receives an input array of integers and returns a new array of integers with the same values as the input array, except the first and last elements being swapped. The replaceEvensWithZeros method receives an input array of integers and returns a new array of integers with the same values as the input array, except that all even elements are replaced with The largestElement method receives an input array of integers and returns the largest value in this array You will need to use looping statements and method calls. A screenshot of the execution of your program should look like this: This in Java using netbeains also pleaze build of the code added package arrayeditor; public class ArrayEditor static String getAllElementsint input String output ; Complete this method return output; static int swapFirstLastint input int output new intinputlength; Complete this method return output; static int replaceEvensWithZerosint input int output new intinputlength; Complete this method return output; static int largestElementint input int largest Integer.MINVALUE; Complete this method return largest; public static void mainString args int TenNumbers new int; for int index ; index TenNumbers.length; index TenNumbersindexintMathrandom; System.out.printlnAll elements: getAllElementsTenNumbers; System.out.printlnAfter swapping the first and last elements in the array: getAllElementsswapFirstLastTenNumbers; System.out.printlnAfter replacing all even elements with : getAllElementsreplaceEvensWithZerosTenNumbers; System.out.printlnThe largest value: largestElementTenNumbers;
P ArrayEditor points
The attached ArrayEditor program initializes the TenNumbers array with ten random integers. Begin by importing
the ArrayEditor project to NetBeans. Next, modify the methods in this program so that the program prints four lines
of output, containing:
All elements in the TenNumbers array.
The contents of TenNumbers, after swapping the first and last elements in the array
The contents of enNumbers, after replacing all even elements with
The largest value in TenNumbers.
The provided seed code has four method declarations:
The getAllElements method receives an input array of integers and returns a String with all the values in
the array.
The swapFirstLast method receives an input array of integers and returns a new array of integers with the
same values as the input array, except the first and last elements being swapped.
The replaceEvensWithZeros method receives an input array of integers and returns a new array of
integers with the same values as the input array, except that all even elements are replaced with
The largestElement method receives an input array of integers and returns the largest value in this array
You will need to use looping statements and method calls.
A screenshot of the execution of your program should look like this:
This in Java using netbeains also pleaze build of the code added
package arrayeditor;
public class ArrayEditor
static String getAllElementsint input
String output ;
Complete this method
return output;
static int swapFirstLastint input
int output new intinputlength;
Complete this method
return output;
static int replaceEvensWithZerosint input
int output new intinputlength;
Complete this method
return output;
static int largestElementint input
int largest Integer.MINVALUE;
Complete this method
return largest;
public static void mainString args
int TenNumbers new int;
for int index ; index TenNumbers.length; index
TenNumbersindexintMathrandom;
System.out.printlnAll elements: getAllElementsTenNumbers;
System.out.printlnAfter swapping the first and last elements in the array: getAllElementsswapFirstLastTenNumbers;
System.out.printlnAfter replacing all even elements with : getAllElementsreplaceEvensWithZerosTenNumbers;
System.out.printlnThe largest value: largestElementTenNumbers;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started