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]
3 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]3 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
A cathedral hull allows the boat to do what
Hoochie [10]
It allows power boats to have stability while cruising. The cathedral hull  is like a trimaran in terehat it has one main  and two side hulls stuck together so that has a somewhat square to rectangular shape and therefore exhibits greater stability than a single hulled boat. It became more popular with the advent of fibreglass boats in the 1960's and '70s.
5 0
3 years ago
Computer programming
Svet_ta [14]
Sjanqknjwolq esjkalqlkd
5 0
2 years ago
Which of the following statements isNOT true about abstract data types (ADTs)?A list is anexample of an ADT.ADTs hide theimpleme
Fynjy0 [20]

Answer:

Java provide all the ADTs you need,therefore you do not need to create any newones.

This statement is not true.

Explanation:

ADTs are those data types which we use but we didn't know their inner working that is how it is working what is happening inside.It is commonly used for Data Structures for example:- In stack we use push and pop operations to insert and to delete element from a stack respectively but we didn't know how it is happening inside.How the stack is implemented and etc.Java provides most of the ADT's but not all.

5 0
2 years ago
Which Boolean operator produces the result 1 only if both values are 1? Which Boolean operator produces the result 0 only if bot
lorasvet [3.4K]

Blank 1 is AND

Blank 2 is OR

5 0
3 years ago
How to post a answer
SSSSS [86.1K]
………………….yes yes yes
6 0
3 years ago
Other questions:
  • Tim has an old server computer that his company uses as a backup. One of the hard drives has gone bad and needs to be replaced.
    13·1 answer
  • What is the purpose of system calls, and how do system calls relate to the OS and to the concept of dual-mode (kernel-mode and u
    14·1 answer
  • Create an array of numbers filled by the random number generator. (value = (int)(Math.random() * 100 + 1);) Print the array and
    9·1 answer
  • A function ________ contains the statements that make up the function.
    5·1 answer
  • How does the post process alert the user if it detects a hardware problem during the post process?
    6·1 answer
  • What is the main difference between weathering, erosion and leaching​
    9·1 answer
  • ARGENT !!20 POINTS <br> А ________ translates commands from a computer to draw lines on paper.
    10·2 answers
  • I have a question, but it's not a math question. Can anyone give me 5 unblockers for school computers? If you answer this, you w
    5·2 answers
  • FOR A BRAINLIEST
    14·1 answer
  • . prevalence of coronary artery disease in patients with isolated aortic valve stenosis. br heart j. 1984;51:121–4.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!