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
What type of media is a hard disk​
anyanavicka [17]

Answer:

A hard disk provides a high-capacity alternative to magnetic storage media. It contains metal platters coated with a magnetic layer. The platters usually spin continuously when a computer is on, storing data in different sectors on the magnetic disk.

Explanation:

5 0
3 years ago
What is a unit to measure loudness
FinnZ [79.3K]

decibels i believe is the correct answer. hope it helps :)

3 0
2 years ago
The process of capturing moving images on film or a digital storage device is called?
galben [10]

Answer:

Cinematography

Explanation:

Cinematography is the blend of art and science and it deals with the recording of moving images on film or a digital storage device.

While making a movie some example of cinematography are the conclusions reached about lighting, camera filters, lenses etc.

6 0
3 years ago
FREE BRAINLIEST!!!
Nastasia [14]

Answer:

B

Explanation:

4 0
3 years ago
Read 2 more answers
23. What is the value of 3 - (4 + 2 *3)/(8-2) + 7 * 2+4
Artist 52 [7]

Answer:

30 djjjjj*fjfktdyldydxpitdotdtiotdtod

8 0
3 years ago
Other questions:
  • For all those among our fans and SpongeBob fans which is better SpongeBob or amount us
    11·2 answers
  • Someone please help! Please fill this out
    10·1 answer
  • Cyberterrorism is the use of terrorism to attack (Points : 1) public libraries. computer based networks. government spy networks
    15·1 answer
  • Whats the best app for cheaters​
    9·1 answer
  • What is performance? Multiple Choice measures how quickly a system performs a process or transaction a system that is not operat
    9·2 answers
  • 2.2-2 Consider sorting numbers stored in array by first finding the smallest element n A of and exchanging it with the element i
    11·1 answer
  • Carrie works on a help desk and is assigned a ticket that was automatically generated by a server because of an error. The error
    14·2 answers
  • Write an assembly program that will prompt the user for 3 inputs (let’s abstractly call them a, b, and c) without a leading stri
    13·1 answer
  • Stephanie would like to know the average number of regular hours worked by her employees. In cell B11, create a formula using th
    8·1 answer
  • I don't know if this is supposed to go here or art but i need help with photoshop, basically you can create whatever you want bu
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!