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
2. Sherry bought the following articles
sineoko [7]

Answer:

Total amount paid → $3525

Explanation:

       Articles                  unit rate               Quantity              Total amount

1). Banarasi sarees         $1500                      2                          $3000

2). Shirting                      $30                          8                          $240

3). Bed sheets                $40.50                    2                           $81

4). Cloth                          $20.25                    8                           $162

5). Handkerchiefs          $3.50                       12                         $42

                                                                                      Total → $3525      

Therefore, total amount paid to purchase the articles given is $3525.        

8 0
3 years ago
Who Has any idea How to code?
kkurt [141]
A bit I guess. I can only do C# though
8 0
3 years ago
Read 2 more answers
Why MUST you request your DSO signed I-20 ship as soon as it is ready and who is responsible to request the I-20
Klio2033 [76]

Why MUST you request your DSO signed I-20 ship as soon as it is ready and who is responsible to request the I-20?

a. It is required you have an endorsed/signed I-20 when Customs and Border Patrol or police ask for it

b. We only keep an unsigned digital copy and cannot sign an I-20 after the fact

c. It is against U.S. regulations to send digital (signed or not) DS-2019s and must treat I-20s the same

d. You will need all signed original I-20s to make copies to apply for OPT, STEM and H-1B in the future, so get them now!

e. It is the student’s choice to request each term, however, we cannot go back retroactively to provide past copies

f. We can only provide a signed copy of current I-20 and if changes occur from previous semesters that information will not show

g. The original endorsed I-20 signed by a DSO will be destroyed after 30 days of issuance if not picked up, and it cannot be replicated

h. The cost to have I-20 shipped may go up at any time

i. All the above

Answer:

i. All the above

Explanation:

DSO means designated school officials and they have to do with Student and Exchange Visitor Program (SEVP)-certified schools where students have to get a Form I-20, “Certificate of Eligibility for Nonimmigrant Student Status which provides information about the student's F or M status.

What a student must request for from his DSO signed I-20 ship are all the above options.

8 0
3 years ago
Supose that there are exactly 733 monks in the world.
kramer

A statement which is true about the monks is that: There is a day of the year that is the birthday of at least 3 monks.

<h3>What is a conditional statement?</h3>

A conditional statement can be defined as a statement that can be written to contain both a hypothesis and conclusion. Thus, it typically has the form "if P then Q."

Where:

P and Q represent sentences.

<h3>What is a converse statement?</h3>

A converse statement can be defined as a type of statement that is obtained by switching (reversing) the hypothesis and conclusion of a conditional statement. This ultimately implies that, the converse of a statement is obtained by switching (reversing) the hypothesis and  conclusion of a conditional statement.

In this context, we can reasonably infer and logically deduce that a statement which is true about the monks is that there is a day of the year that is the birthday of at least 3 monks because a year only has 365 days.

Read more on conditional statement here: brainly.com/question/16951916

#SPJ1

Complete Question:

Suppose that there are exactly 733 monks in the world.

Which one of the following statements is true about the monks?

Every day of the year, it's a monk's birthday.

There is a day of the year that is the birthday of exactly 3 monks

There is a monk who celebrates his birthday on a Tuesday

There is a day of the year that is the birthday of at least 3 monks

Some monk turns years at the weekend

None of the above.​

5 0
2 years ago
How do you implement instruction-level parallelism?
USPshnik [31]

A. by combining similar instructions into groups, which will then execute in parallel

5 0
3 years ago
Read 2 more answers
Other questions:
  • Which do switches create?<br> Networks<br> Wireless access points<br> Routes<br> Collision domains
    12·1 answer
  • Do you think technology and social media have made it easier or more difficult to make connections and find a job? Explain.
    12·1 answer
  • ​Which of the following styles sets the column breaks within paragraphs to leave a minimum of two and three lines at the top and
    11·1 answer
  • A customer contacts the help disk stating a laptop does not remain charged for more than 30 minutes and will not charge more tha
    9·1 answer
  • Your mom calls you. She is creating a book of poetry. Many of these poems only take up the first half of a document . She asks i
    10·2 answers
  • Are scripted languages easier or more difficult to port than programming languages? Why?
    6·1 answer
  • What do you need for digital photography? 1. 2. 3.
    13·1 answer
  • What was Bill Gates purpose for starting a business?
    12·1 answer
  • What is the 6 example of computer hardware and explain​
    6·1 answer
  • an existing technology that would allow users to transfer images from the camera to the computer without connecting them
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!