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
yulyashka [42]
2 years ago
8

Class Main {

Computers and Technology
1 answer:
tatyana61 [14]2 years ago
6 0

See below for the modified program in Java

<h3>How to modify the program?</h3>

The for loop statements in the program are:

  • for (int i = 0; i < arr.length; i++) { arr[i] = rd.nextInt(1000); }
  • for (int i = 0; i < arr.length; i++) { System.out.println(arr[i]); }

To use the enhanced for loop, we make use of the for each statement.

This syntax of the enhanced for loop is:

for(int elem : elems)

Where elem is an integer variable and elems is an array or arrayList

So, we have the following modifications:

  • i = 0; for (int num : arr){ arr[i] = rd.nextInt(1000); i++;}
  • for (int num : arr) { System.out.println(num); }

Hence, the modified program in Java is:

class Main {

static int[] createRandomArray(int nrElements) {

Random rd = new Random();

int[] arr = new int[nrElements];

int i = 0;

for (int num : arr){

arr[i] = rd.nextInt(1000);

i++;

}

return arr;

}

static void printArray(int[] arr) {

for (int num : arr) {

System.out.println(num);

}

}

}

public static void main(String[] args) {

int[] arr = createRandomArray(5);

printArray(arr);

}

}

Read more about enhanced for loop at:

brainly.com/question/14555679

#SPJ1

You might be interested in
What is the connection between sites that allows for intersite replication called? (Points : 5) Bridgehead server
Travka [436]

Answer: Site Link

Explanation: Site link is the type connection that is created for the different sites.It helps in the connectivity in the multiple site surrounding known as inter-site and transferring the traffic created by the replication activity.

Other options are incorrect because bridgehead servers is a device to control the domain,subnet is the part of the IP network and domain is used for the identification of address .Thus, the correct option is site link.

4 0
3 years ago
Please explain what Level 5 Automation is and give 2 examples of the technology.
arsen [322]

Level 5 ( Full Driving Automation ) Level 5 cars won't even have steering wheels or acceleration / braking pedals . They will be free from geofencing , able to go anywhere and do anything that an experienced human driver can do .

Pls follow me and Mark as brainlest!!! :-)

8 0
3 years ago
FS EVERFI:
Snowcat [4.5K]

Answer:

A) work study program

Explanation:

Because you need experience and scholarships don't always pay, so this is the best choice.

6 0
2 years ago
Read 2 more answers
Suppose you were assigned to develop a logical model of the registration system at a school or college. Would you be better off
BaLLatris [955]

Answer:

top down approach

Explanation:

Top down approach is process of breaking down system into sub-system which helps in formulating the overall system. At the end every sub system can be refined with more details.

While bottom up approach is process of gathering systems to design large complex system.

Top down is better as basic information is present and resources can be utilized effectively without impacting maintennance and operations.

6 0
3 years ago
The file command provides information about any file system object (i.e., file, directory or link) that is provided to it as an
NeTakaya

Answer:

The answer is "Option a, c, and d".

Explanation:

This command aims to define the argumentation from each entity of the file system like a disc, path, or link. It checks the usage of a measurement system, which is requested to collect the information from either the inode of the item, the description of the option as follows:

  • In option a, It is used to identify the file type.
  • In option c, This command is used to list all file types.
  • In option d, This command is used to list all the current directories.
  • In option b, It is used to describe a single entity directory.
7 0
3 years ago
Other questions:
  • In which of the following situations may you pass on the right
    13·2 answers
  • What does ‘‘negotiation’’ mean when discussing network protocols? give an example?
    15·1 answer
  • python A pet shop wants to give a discount to its clients if they buy one or more pets. The discount is equal to 20 percent of t
    12·1 answer
  • Which types of operating systems execute program independent of the users and generate output within a specific amount of time?
    5·1 answer
  • I need to write a really simple python program to solve this issue. I have most of the program written but, when I run the secon
    8·1 answer
  • (a) Store last 7 digits of your student ID in a vector (7 element row or column vector). Write a MATLAB code which creates a 7x7
    11·1 answer
  • When an application contains just one version of a method, you can call the method using a(n) ____ of the correct data type.
    6·1 answer
  • Which logic correctly describes an algorithm to find the smallest of the three numbers a, b, and c and store the smallest number
    15·1 answer
  • How does a programmer use digital waves to transfer sound?
    11·1 answer
  • Pleassseeeee helppp!!!!
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!