Answer:
import java.util.Scanner; //as referenced in the prompt.
public class ArraysKeyValue { //as mentioned in the prompt.
public static void main (String [] args) { //as stated in the prompt.
final int SIZE_LIST = 4;
//as indicated in the prompt.
int[] keysList = new int[SIZE_LIST];
//as specified in the prompt.
int[] itemsList = new int[SIZE_LIST];
//as outlined in the prompt.
int i;
//as identified in the prompt.
keysList[0] = 13;
//as mentioned in the prompt.
keysList[1] = 47;
//as stated in the prompt.
keysList[2] = 71;
//as described in the prompt.
keysList[3] = 59;
//as referenced in the prompt.
itemsList[0] = 12;
//as mentioned in the prompt.
itemsList[1] = 36;
//as stated in the prompt.
itemsList[2] = 72;
//as specified in the prompt.
itemsList[3] = 54;//as indicated in the prompt.
// additional line needed to finalize the solution is as follows--
for(i=0;i<(keysList.length);i++) //Loop to access each element of keysList array variable.
{// open for loop braces
if(keysList[i]>50) // compare the values of keysList array variable with 50.
System.out.println(itemsList[i]); // print the value
}// close for loop braces.
}// close main function braces.
} //close class braces.
Output:
72
54
Explanation:
In the resolution section--
- A single loop is engaged that iterates from 0 to (size-1) of the 'keyslist' array.
- The 'if' statement checks whether the 'keyslist' array's element exceeds 50 or not.
- If it does, the respective 'i' indexed item from the item_list array is printed as well, which corresponds to the higher value of the keyslist array element.