Question: S My library > IFT 2 1 0 : Introduction to Java Technologies home > 6 . 1 0 : Array parameters zyBooks catalog Jump

S My library > IFT 210: Introduction to Java Technologies home >6.10: Array parameters
zyBooks catalog
Jump to level 1
Six integers are read from input and stored into the array arrayToModify. Then, numCompare is read from input. Write a static method modifyArray() that takes an integer array parameter and an integer parameter. For each element in the array, if the element is greater than or equal to the integer parameter, then replace the element with 1. Otherwise, replace the element with -1. Ex: If the input is:
\table[[50,95,60,30,70,35],[56,,,,,]]
then the output is:
]):}
[ New array: -1,1,1,-1,1,-1
import java.util.Scanner;
public class ArrayMethods {
Y* Your code goes here */
public static void printarr(int[] arr){
int i;
for (i=0; i arr. length; ++i){
System.out.print(arr[i]+"");
}
System.out.println();
}
public static votd main(String[] args){
1
2
 S My library > IFT 210: Introduction to Java Technologies home

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!