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 are the oop concept of java
mash [69]

Answer: OOP concepts in Java are the main ideas behind Java’s Object Oriented Programming. They are abstraction, encapsulation, inheritance, and polymorphism. Grasping them is key to understanding how Java works. Basically, Java OOP concepts let us create working methods and variables, then re-use all or part of them without compromising security.

HOPE THIS HELPED IS NOT SORRY.

4 0
2 years ago
Read 2 more answers
Do you think privacy policies are effective in social networking sites?
Kamila [148]

Answer:

When that information gets posted online, it is no longer private, and may end up falling into wrong hands. Even if you have put in place the highest possible security measures, some of your friends, colleagues and companies you interact with on social media, can end up leaking your personal information.

4 0
3 years ago
In Microsoft Exel, graphs are refered to as_________
algol [13]
The answer is charts D since tables are still referred to as tables
4 0
3 years ago
The number of colors in a bitmap image determines which category the image will be in. Complete the following sentences.
Jobisdone [24]

Answer:

Explanation:

1.Grayscale

2.Multitone

7 0
3 years ago
What can we do to positive interaction online?
Julli [10]

Answer:

We can help eachother out with things.

Explanation:

Eg. Schoolwork and homework because our stress level will decrease.

8 0
2 years ago
Read 2 more answers
Other questions:
  • When approved for a loan, an individual essentially applied for aid in the area of...
    15·1 answer
  • What does "FDDI" stand for in Technology?
    5·2 answers
  • What is the full form of bcc please tell​
    15·2 answers
  • "What is the database in which Windows stores all information about hardware, applications, users and system settings?"
    8·1 answer
  • A ________ is a very large general-purpose computer that is capable of performing very many functions as if these are done simul
    8·1 answer
  • one data is in memory the computer interpets and executeinstructions to process the data into informationA. TrueB. False
    8·1 answer
  • What type of network would be suitable for linking all computers in a building
    6·1 answer
  • Choose the best answer from the drop-down menu. A ______ allows multiple connections to a single signal. Without a ______, conne
    7·2 answers
  • What is another name for a numbered list
    6·1 answer
  • An engineer has reported that a printer is no longer working and needs troubleshooting. You have been informed that there is a p
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!