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
In dos operating system ,write a command to delete the directory as well as the files of the directory ''world'' on drive E.
Sergeeva-Olga [200]

Answer:

deltree /y E:\world

Note that the /y option simply tells it to go ahead and answer yes to any confirmation prompts that might occur.  Not necessarily part of the desired answer.

Explanation:

The deltree command tells the system to recursively delete a directory and its contents.

3 0
3 years ago
Give 2 examples of when spreadsheets are used.
Anni [7]

Answer:

exam result mostly in colleges and high schools

3 0
3 years ago
1. why is manufacturing considered the biggest contributor to progress
34kurt

Answer:

A vibrant manufacturing base leads to more research and development, innovation, productivity, exports, and middle-class jobs. Manufacturing helps raise living standards more than any other sector. Manufacturing generates more economic activity than other sectors.

3 0
3 years ago
Help plz
Sonbull [250]

1.

first = float(input("First Entry = "))

second = float(input("Second Entry = "))

def func(num1, num2):

   return max(num1, num2)

print(func(first, second))

2.

first = input("First Entry = ")

second = input("Second Entry = ")

def func(word1, word2):

   return sorted([word1,word2])[0]

print(func(first, second))

I hope this helps!

8 0
3 years ago
You implement basic version control and go through the phase of creating a local repository. Initiate the commands to set up tha
notsponge [240]
Version control is the foundation of DevOps. Gain speed with Helix Core. Get the version control tools you need. Try today. Modern Collaboration. Increase Visibility.
3 0
3 years ago
Other questions:
  • In regards to storing folders the computer can be described as a ________________.
    7·1 answer
  • #Write a function called string_finder. string_finder should #take two parameters: a target string and a search string. #The fun
    14·1 answer
  • Sarah, a computer user, tells James, a computer technician, that the network she is connected to is running too slowly. Which of
    5·1 answer
  • What is a Better Computer?<br> A. Alien<br> B. Microsoft<br> C. Windows<br> D. Apple
    11·2 answers
  • Write a function, sublist, that takes in a list of numbers as the parameter. In the function, use a while loop to return a subli
    13·1 answer
  • How come I haven't moved to the next rank even though I have all of the right things to move on?
    10·2 answers
  • How to chnage email adresss on slate from tophat?
    13·1 answer
  • 30 points Fill in the blanks,<br> Plz leave a explanation
    5·2 answers
  • 1. Write an if statement that assigns 20 to the variable y, and assigns 40 to the variable z
    10·1 answer
  • What do we call the software which programmers use to program?​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!