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
Dmitry [639]
3 years ago
14

Write a program that initializes an array with ten random integers and then prints four lines of output, containing (Horstmann,

01/2013) Horstmann, C. S. (01/2013). Big Java: Early Objects, 5th Edition [VitalSource Bookshelf version]. Retrieved from vbk://9781118545997 Always check citation for accuracy before use.
Computers and Technology
1 answer:
Amiraneli [1.4K]3 years ago
8 0

Answer:

import java.util.Scanner;

import java.util.Random;

public class Solution

{

public static void indexEven(int[] randomNumbers)

{

System.out.print("Even index elements are: ");

for (int i = 0; i < randomNumbers.length; i++)

{

if (i % 2 == 0)

{

System.out.print(randomNumbers[i] + " ");

}

}

System.out.println();

}

public static void evenelement(int[] randomNumbers)

{

System.out.print("Every even element: ");

for (int i = 0; i < randomNumbers.length; i++)

{

if (randomNumbers[i] % 2 == 0)

{

System.out.print(randomNumbers[i] + " ");

}

}

System.out.println();

}

public static void reverseOrder(int[] randomNumbers)

{

System.out.print("All elements in reverse order: ");

for (int i = randomNumbers.length - 1; i >= 0; i--)

{

System.out.print(randomNumbers[i] + " ");

}

System.out.println();

}

public static void firstLast(int[] randomNumbers)

{

System.out.print("First and last elements are: ");

System.out.print(randomNumbers[0] + " " + randomNumbers[randomNumbers.length - 1]);

System.out.println();

}

public static void main(String[] args)

{

// create instance of Random class

Random rand = new Random();

System.out.print("Array: ");

int[] randomNumbers = new int[10];

for (int i = 0; i < randomNumbers.length; i++)

{

randomNumbers[i] = rand.nextInt(100);

System.out.print(randomNumbers[i] + " ");

}

System.out.println();

indexEven(randomNumbers);

evenelement(randomNumbers);

reverseOrder(randomNumbers);

firstLast(randomNumbers);

}

}

Explanation:

You might be interested in
Help please! Coding!
gladu [14]

Answer:

Explanation:

16

17

5 0
3 years ago
How do operating system work?
SIZIF [17.4K]

Answer:

The "operating system" manages software and hardware on the computer. Uploads files, has great memory and processes management.

7 0
2 years ago
Which statement describes the relationship between science and technology?
Elden [556K]
Answer: science is the study of the world, and technology changes the world to solve problems.
3 0
2 years ago
Read 2 more answers
Assume that you have an array of integers named arr. Which of these code segments print the same results?
tresset_1 [31]

Answer:

II and III only

Explanation:

In Code segment II, the output of the array will be started form arr[0] and ends at the arr[length]. Because loop starts from 0 and ends at length of array. This will print the full array data.

In code segment III, the output will be all values of array as loop starts form first index and ends at last index.

On the other hand I code segment prints all array values except last value of the array. As the loop shows that, it will terminate at second last value of the array.

4 0
3 years ago
The purchase and subsequent sale of a securities position in a customer account solely to generate commissions is____________.
Citrus2011 [14]

Answer:

Churning

Explanation:

Churning is termed as an act of a broker conducting immoderate trading in the account of client solely to generate commissions. It is an illegal and deceptive practice. It violates security laws. The purchase and subsequent sale of a securities that are little or insignificant to meet the investment goals of client can be the evidence of churning. Consequently it causes considerable losses in client's account or can produce a tax liability.

Churning occurs due to over trading by a broker to generate commissions by buying and selling stocks excessively on the behalf of investor. This often happens when broker has permissive authority over client's account.

5 0
3 years ago
Other questions:
  • How do smart watches affect the business and its position in the global marketplace?
    12·2 answers
  • What kind of voltage do solar cells generate? Solar cells produce ______ voltage which is not usable by most household appliance
    15·1 answer
  • What does it mean to be self demanding?
    12·1 answer
  • Create a program named Reverse3 whose Main() method declares three integers named firstInt, middleInt, and lastInt. Assign the f
    9·1 answer
  • Is downloading like installing?
    13·1 answer
  • List the step in turning on a computer
    6·1 answer
  • The following is an example of what kind of loop?
    15·2 answers
  • Premise: Tracy has a file that contains a list of actors and the movies in which they acted. She wants to know the top 3 ranked
    8·1 answer
  • What bonnie is this? From five night at freddys
    9·1 answer
  • Select one Layer 2 or wireless WAN technology presented in Lesson 3. Elaborate on its characteristics, pros and cons, and common
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!