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
kakasveta [241]
3 years ago
15

In JAVA please:

Computers and Technology
1 answer:
blagie [28]3 years ago
5 0

Answer:

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;  

/* Your solution goes here */

for ( i = 0; i < SIZE_LIST; i++){

 if (keysList[i]>50){

  System.out.println(itemsList[i] + " ");  }  }

System.out.println("");

}

}

Explanation:

I will explain the whole program flow.

  • There are two arrays here
  • keysList and itemsList
  • The first list (keysList) contains the following elements:

13 element at first position of the array (0th index)

47 element at second  position of the array (1st index)

71 element at third position of the array (2nd index)

59 element at fourth position of the array (3rd index)

  • The other list (itemsList) contains the following elements:

12 element at first position of the array (0th index)

36 element at second  position of the array (1st index)

72 element at third position of the array (2nd index)

54 element at fourth position of the array (3rd index)

  • The size of the array elements is fixed which is 4 and is stored in the variable SIZE_LIST.
  • Then the loop starts. The loop contains a variable i which is initialized to 0. First it checks if the value of i is less than the size of the list. It is true as SIZE_LIST=4 and i=0.
  • So the program control enters the body of the loop.
  • In first iteration, IF condition checks if the i-th element of the keysList is greater than 50. As i=0 So the element at 0th index of the keysList is 13 which is not greater than 50 so the body of IF statement will not execute as the condition evaluates to false. The value of i increments by 1 so now i becomes 1.
  • In next iteration loop again checks if the value of i is less than the size of the list which is true again so the body of the loop executes.
  • IF condition checks if the i-th element of the keysList is greater than 50. As i=1 So the element at 1st index of the keysList is 47 which is not greater than 50 so the body of IF statement will not execute as the condition evaluates to false. The value of i is incremented by 1 so now i becomes 2.
  • In next iteration loop again checks if the value of i is less than the size of the list which is true again as i= 2 which is less than SIZE_LIST so the body of the loop executes.
  • IF condition checks if the i-th element of the keysList is greater than 50. As i=2 So the element at 2nd index of the keysList is 71 which is greater than 50 so the body of IF statement is executed as the condition evaluates to true. So in the body of the IF statement there is a print statement which prints the i-th element of the itemsList. As i = 2 so the value at the index 2 of the itemsList is displayed in the output which is 72. Next value of i is incremented by 1 so now i becomes 3.
  • In next iteration loop again checks if the value of i is less than the size of the list which is true again as i= 3 which is less than SIZE_LIST so the body of the loop executes.
  • IF condition checks if the i-th element of the keysList is greater than 50. As i=3 So the element at 3rd index of the keysList is 59 which is greater than 50 so the body of IF statement is executed as the condition evaluates to true. So in the body of the IF statement there is a print statement which prints the i-th element of the itemsList. As i = 3 so the value at the index 3 of the itemsList is displayed in the output which is 54. Next value of i is incremented by 1 so now i becomes 4.
  • In next iteration loop again checks if the value of i is less than the size of the list which is now false as i=4 which is equal to the SIZE_LIST= 4. So the loop breaks.
  • So the output of the above program is:

72

54

You might be interested in
A communication pattern in which the parties slowly reduce their dependence on one another, withdraw, and become less invested i
zepelin [54]

Answer:

The correct answer to the following question is option A. an avoidance spiral.

Explanation:

An avoidance spiral is a spiral in which parties avoid the conflicts at all cost in which leads to reducing the influence, dependence, etc. This spiral can also be destructive.

In other words, it is the only spiral in parties slowly reduces their dependence and the influence on the one and another.

7 0
3 years ago
Often an extension of a memorandum of understanding (MOU), the blanket purchase agreement (BPA) serves as an agreement that docu
Alchen [17]

Answer:

FALSE

Explanation:

The blanket purchase agreement (BPA) can not serves as an agreement that documents the technical requirements of interconnected assets but the Interconnection service agreement (ISA).

3 0
3 years ago
unlike tv or newspaper ads, internet communications are interactive, and consumers can choose which messages and information the
Softa [21]

Companies often engage the services of Advertising firms to market their products. Company web offerings can be tailor-made for the consumers.

  • Advertising agencies are firms that makes, plan and handle the advertising needs of any business. They are known for handling negotiations creating tailored marketing campaigns.

A lot of agencies do not want to talk about pricing until they know what you can afford to spend.

Tailored content are delivered experiences that speak directly to customers.

This agencies uses their connections and resources to make one's campaign successful and cost-efficient.

Learn more from

brainly.com/question/23477855

5 0
2 years ago
Click/press _______ to remove the most recently typed text.
bagirrra123 [75]

Answer:

ctrl Z

Explanation:

ctrl Z is the shortcut for undo it will reverse the last thing you did ctrl Y is redo if i accidently did ctrl Z i can do ctrl Y. Hope this helps!

6 0
3 years ago
Information should be________to ensure more than one source provides the same factual information. a. repeated c. cross-lined b.
Assoli18 [71]

Information should be cross-checked to ensure more than one source provides the same factual information.

<h3>What is the source of information?</h3>

The source of information is the place, from where the data or information is generated. There are many sources of information, like internet, newspaper, television etc.

The options given in the problem regarding the information as,

  • a. repeated
  • b. cross-examined
  • c. cross-lined
  • d. cross-checked

There are many feck news and nonfactual data is present over the internet and other source of information.

To get the factual information, one should always cross-checked the information from other sources.

Thus, the information should be cross-checked to ensure more than one source provides the same factual information.

Learn more about the source of information here;

brainly.com/question/26169752

7 0
1 year ago
Other questions:
  • &gt;
    6·1 answer
  • What mobile operating system below requires all applications to be reviewed and approved before they can be made available in th
    7·1 answer
  • Two system administrators who work in two different buildings for the same company want to open a communication channel between
    8·1 answer
  • Organizing speech ideas according to physical space, direction, or location calls for a _____ organizational pattern.
    11·1 answer
  • The relationship between social media and the Internet is complex. Individual Internet behavior involves a myriad of factors tha
    6·1 answer
  • Choose the term that best matches the definition.
    9·1 answer
  • Which of the following statements about recommendation engines is TRUE?A: An online recommendation engine is a set of algorithms
    10·1 answer
  • The ______ engine compares your entry against its database and returns a list of hits or sites that contain the keywords. (hint:
    8·1 answer
  • Database queries is an example of
    14·1 answer
  • PLEASE HELP! I accidently looked up a link, and now this same link keeps popping up everywhere, how do I stop this!?!? please he
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!