1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
DedPeter [7]
4 years ago
8

For any element in keysList with a value greater than 50, print the corresponding value in itemsList, followed by a space. Ex: I

f keysList = {32, 105, 101, 35} and itemsList = {10, 20, 30, 40}, print: 20 30
JAVA

import java.util.Scanner;

public class ArraysKeyValue {
public static void main (String [] args) {

final int SIZE_LIST = 4;
int[] keysList = new int[SIZE_LIST];
int[] itemsList = new int[SIZE_LIST];
int i;

keysList[0] = 13;
keysList[1] = 47;
keysList[2] = 71;
keysList[3] = 59;

itemsList[0] = 12;
itemsList[1] = 36;
itemsList[2] = 72;
itemsList[3] = 54;
Computers and Technology
1 answer:
VARVARA [1.3K]4 years ago
5 0

Answer:

import java.util.Scanner;  //mentioned in the question.

public class ArraysKeyValue {  //mentioned in the question.

public static void main (String [] args) {  //mentioned in the question.

final int SIZE_LIST = 4; //mentioned in the question.

int[] keysList = new int[SIZE_LIST]; //mentioned in the question.

int[] itemsList = new int[SIZE_LIST]; //mentioned in the question.

int i; //mentioned in the question.

keysList[0] = 13; //mentioned in the question.                                

keysList[1] = 47; //mentioned in the question.

keysList[2] = 71; //mentioned in the question.

keysList[3] = 59; //mentioned in the question.

itemsList[0] = 12; //mentioned in the question.

itemsList[1] = 36; //mentioned in the question.

itemsList[2] = 72; //mentioned in the question.

itemsList[3] = 54;//mentioned in the question.

// other line to complete the solution is as follows--

for(i=0;i<(keysList.length);i++) //Loop to access all the element of keysList array variable.

    {// open for loop braces

        if(keysList[i]>50) // compare the value of keysList array variable with 50.

        System.out.println(itemsList[i]); // print the value

   }// close for loop braces.

}//  close main function braces.

} //close the class braces.

Output:

72

54

Explanation:

In the solution part--

  1. One loop is placed which moves from 0 to (size-1) of the 'keyslist' array.
  2. Then the 'if' statement is used to check the element of 'keyslist' array, which is greater than 50 or not.
  3. If it is greater, then print the element of item_list array of 'i' index which is also the index of greater value of keyslist array element.

You might be interested in
Which item best describes fiber optic transmission?
sveticcg [70]

Answer:

a

Explanation:

analog signal sent through tiny glass strands

6 0
3 years ago
Which button would you use to quickly add addresses to a mail merge envelope?
Jet001 [13]

The answer to your question is,

C. Address Block

-Mabel <3

5 0
4 years ago
The throws clause of a method: a. specifies the exceptions thrown by the calling method. b. specifies the exceptions a method th
Wittaler [7]

Answer:

Option B

Explanation:

8 0
3 years ago
I’m nobody. Who are you?
stepan [7]

Answer:

The poet praises the common man.

Explanation:

8 0
3 years ago
Read 2 more answers
How do you ask brainy a question without it not liking the question and saying it hurts their feelings?
murzikaleks [220]
IM SORRY but i dont now your question

7 0
4 years ago
Other questions:
  • Which resource helps a user access a cloud service?
    13·2 answers
  • which of the following is an educated or informed guess that is proposed and supported with verifiable evidence
    12·1 answer
  • Whats your favorite sport between these options?
    12·2 answers
  • __________ describes a module for which the software developer does not care how the processing is performed, but instead, knows
    7·1 answer
  • Write a program that prompts the user to input the decimal value of a double and outputs the number rounded to the nearest integ
    7·1 answer
  • What is the primary benefit of using solid state storage
    7·1 answer
  • Inaccurate __________ is the number-one reason why many small businesses go bankrupt.
    5·1 answer
  • Discuss the infrastructure necessary for the Internet of Things and Cloud computing to exist. What unique services does this ena
    7·1 answer
  • Helllllllllppppppppppp
    9·1 answer
  • What are the different elements of a window?​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!