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
A file that contains program code is called a ____________.
BartSMP [9]
Executable or binary
4 0
3 years ago
A portable electronic device that can be used in an emergency to stop someone’s heart from going out of rhythm is called a/an
JulsSmile [24]
It is called a Heart pace maker
7 0
3 years ago
Read 2 more answers
Which of the following is an example of how cookies are used? To create a stronger password To customize advertisements based on
fiasKO [112]

The one among the options that is an example of how cookies are used to customize advertisements based on your history.

<h3>What do cookies do?</h3>

A cookie is known to be a kind of a small text file that is said to be often saved on your computer if a person do visit any kind of websites.

Note also that  a cookie is often used to get one to often remember settings that they have their last visit to any website.

For example Amazon is known to often cookies to help to know if or when a person revisit the site.

Hence, The one among the options that is an example of how cookies are used to customize advertisements based on your history.

Learn more about cookies from

brainly.com/question/14102192

#SPJ1

8 0
2 years ago
What does it mean by null in programming?
Marysya12 [62]
In computer programming<span>, </span>null<span> is both a value and a pointer. </span>Null<span> is a built-in constant that has a value of zero. It is the same as the character \0 used to terminate strings in C. </span>Null<span> can also be the value of a pointer, which is the same as zero unless the CPU supports a special bit pattern for a </span>null<span> pointer.</span>
8 0
3 years ago
2. What is the name for an action performed by the VR Robot?
pychu [463]
Parameter is the answer you wanted
4 0
3 years ago
Read 2 more answers
Other questions:
  • A suspension system that allows one wheel to move up and down with minimal effect on the opposite wheel is called what? A. Stabi
    14·2 answers
  • According to the Big Five Factors model, all but _____ are categories.
    11·1 answer
  • Where do you access the status report of an assigned task that is open?
    12·2 answers
  • Which is the most effective manner to deliver a speech inmost business settings?extemporaneous presentationmemorizationreadingvi
    9·1 answer
  • Which vendor certification would you think is the most relevant in the field of IT security? Why?
    7·1 answer
  • What is information processing cycle​
    12·1 answer
  • In this problem, you will fill in the code for a function count_digits(val) that takes a positive integer, val, and returns a li
    12·1 answer
  • what does it mean if you get the brainlyest ?and why does everyone want it so bad? and how do i give it to someone?
    6·1 answer
  • To edit the color of the text in Word Online, choose the Font color command under what tab?
    8·1 answer
  • USE PYTHON TURTLE GRAPHICS
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!