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
I recorded a video on my windows PC, but when i tried to play it i got this message:
Anit [1.1K]

Answer:

yes. Look up popular video repair sites and download it (unless its online) but dont just go clicking on random things you dont want to give yourself a virus XD

Explanation:

7 0
2 years ago
Read 2 more answers
How long will twenty percent of battery life last me?
Ghella [55]
About one or two hours.
5 0
3 years ago
Read 2 more answers
_ is a model of computing in which computer processing, storage, software, and other services are provided as a shared pool of v
Jet001 [13]

Answer:

Cloud computing is the correct answer of this question.

Explanation:

Cloud computing presents a easy way of consuming databases, servers, repositories and a vast variety of web technology infrastructure.Cloud computing allows that can save considerable construction costs without relying on internal server resources and device requirements.Cloud computing is the provision of various resources over the Web.

8 0
3 years ago
What is the main advantage of using a WYSIWYG("what you see is what you get")editor when constructing a website
Tomtit [17]

Answer:

c

12121212121212121212121212121221212121212121212

7 0
2 years ago
3X5
yan [13]

Answer:

15

Explanation:

cause when you multiply three by five it will give u 15

7 0
2 years ago
Other questions:
  • Discuss 2D gameplay and how new platforms such as cell phones are taking advantages of this renewed market
    5·1 answer
  • When looking through the documentation for a specific class, you never actually see the source code for that class. Instead, you
    6·1 answer
  • The Active Directory Users and Computers tool can be used to:______.
    11·1 answer
  • What word describes the complexity of document
    13·1 answer
  • When he takes a picture, Simon freezes an action without blurring it, to show movement. Which type of photographer is he?
    9·2 answers
  • List the steps in setting up an online banking account
    12·2 answers
  • Why is the answer B?
    6·1 answer
  • Accepting criticism is a trait of what people?
    5·1 answer
  • 1. Accessing calendars, contact information, emails, files and folders, instant messages, presentation, and task lists over the
    7·1 answer
  • 8.2 Code Practice Edhesive
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!