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
Leto [7]
3 years ago
9

9.6 Code Practice: Question 1

Computers and Technology
1 answer:
worty [1.4K]3 years ago
8 0

Answer:

  1. import java.util.Random;
  2. import java.util.Arrays;
  3. public class Main {
  4.    public static void main(String[] args) {
  5.        int n = 10;
  6.        int [] myArray = new int[n];
  7.        buildArray(myArray, n);
  8.        System.out.println(Arrays.toString(myArray));
  9.    }
  10.    public static void buildArray(int[] arr, int n){
  11.        for(int i=0; i < arr.length; i++){
  12.            Random rand = new Random();
  13.            arr[i] = rand.nextInt(90) +10;
  14.        }
  15.    }
  16. }

Explanation:

Firstly, create a method buildArray that take two inputs, an array and an array size (Line 12). In the method, use random nextInt method to repeatedly generate a two digit random number within a for loop that will loop over array size number of times (Line 13-15). The expression rand.nextInt(90) + 10 will generate digits between 10 - 99.

In the main program, call the build array method by using an array and array size as input arguments (Line 8). At last, print the array after calling the buildArray method (Line 9).

You might be interested in
When an attacker presents a program or himself as someone else to obtain private information and pretends to be a legitimate web
timofeeve [1]
A spoofing attack. "<span>a situation in which one person or program successfully masquerades as another by falsifying data, thereby gaining an illegitimate advantage."</span>
8 0
3 years ago
How can data be calculated?
Advocard [28]

Answer:

Data can be calculated by solving an equation

Explanation:

8 0
2 years ago
Read 2 more answers
You started using a new Windows server three months ago. Since that time, you have found that the system slows down and crashes
Brut [27]

Answer: Open Reliability Monitor.

Explanation:

The simplest way to view this information is to open the reliability monitor.

The Reliability Monitor shows you the stability history of a system at a glance and also allows one to see the details of the events that has an effect on reliability on a daily basis.

The reliability and problem history chart which can be seen in the Reliability Monitor helps in keeping track of the overall health of the server on a daily basis.

4 0
2 years ago
Which of the following names in a program is equivalent to the name int?
kirill115 [55]
Im guessing js, python etc.

3 0
3 years ago
Read 2 more answers
Which of the following is TRUE about this statement?
Lynna [10]

E. This statement increments (++) the dereferenced pointer's value (array) by one then "assign" that value.

7 0
3 years ago
Other questions:
  • What is the output of this program?
    8·1 answer
  • Which of the following tasks requires you to use the Tabs option?
    12·1 answer
  • When changing the formatting of a spreadsheet to make it more readable, you should use light blue text on a bright blue backgrou
    12·1 answer
  • What's the main idea??
    12·1 answer
  • A network systems administrator would most likely help with
    13·2 answers
  • Give one example of where augmented reality is used​
    11·2 answers
  • Is it true or false and incomplete doing can be saved in Paint​
    15·1 answer
  • A computing company is running a set of processes every day. Each process has its own start time and finish time, during which i
    11·1 answer
  • Q4. Write down the JavaScript statements to perform the following tasks.
    7·1 answer
  • A third party that provides a computer system such as Windows, programming applications, databases, and web servers is demonstra
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!