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

Create the arrays and assign randomized values for each element in the array. The randomized values should range from 1 to twice

the size of the array. For example, for an array of 200, assign random values between 1 and 400. Use a constant for the size of the array. Edit the value of the constant in different runs of the program to account for the various array sizes.
Computers and Technology
1 answer:
lutik1710 [3]3 years ago
4 0

Answer:

In Java:

import java.util.Random;

public class Main {

  public static void main(String[] args) {

      final int arrsize = 10;

     Random rd = new Random();

     int[] arr = new int[arrsize];

     for (int kount = 0; kount < arrsize; kount++) {

        arr[kount] = rd.nextInt(arrsize*2-1) + 1;

        System.out.print(arr[kount]+" ");      }   }}

Explanation:

This declares the array size as a constant integer

      final int arrsize = 10;

This creates a Random object

     Random rd = new Random();

This declares an array of arrsize size

     int[] arr = new int[arrsize];

This iterates through the array

     for (int kount = 0; kount < arrsize; kount++) {

This generates the random values between 1 and arrsize * 2

        arr[kount] = rd.nextInt(arrsize*2-1) + 1;

This prints the elements of the array

        System.out.print(arr[kount]+" ");      }

You might be interested in
Check the devices that are external peripheral devices:
irina [24]

Answer:

Mouse, and keyboard

Explanation:

Common Sense

6 0
3 years ago
PLS HELP) Early word processors ran on devices that looked like digital _______?
stealth61 [152]
I looked it up it just says true
8 0
3 years ago
Read 2 more answers
C++ question:
gogolik [260]
There's no "using namespace std;" statement. I see no reason for COLOR to be two dimensional or have a length of 5 with only four elements. The inside of the for loop with variable 'J' makes no sense.
3 0
3 years ago
Read 2 more answers
A web site with which web address ending is most likely to contain biased information? an address ending in .edu an address endi
soldier1979 [14.2K]
A web address would most likely contain biased information when it has a domain of .com. The domain extension is considered to be the most popular because it has a wide variety of functions in media or industry. The other domains in the choices are controlled by an institution or the government.
5 0
4 years ago
Read 2 more answers
How can getchar function be used to read multicharacter strings?​
alex41 [277]

69696969696969969696969696966969696969696V69696969696969969696969696966969696969696VVVV696969696969699696969696969669696969696966969696969696996969696969696696969696969669696969696969969696969696966969696969696V69696969696969969696969696966969696969696V6969696969696996969696969696696969696969669696969696969969696969696966969696969696V69696969696969969696969696966969696969696VVVV696969696969699696969696969669696969696966969696969696996969696969696696969696969669696969696969969696969696966969696969696V69696969696969969696969696966969696969696V6969696969696996969696969696696969696969669696969696969969696969696966969696969696V69696969696969969696969696966969696969696VVVV696969696969699696969696969669696969696966969696969696996969696969696696969696969669696969696969969696969696966969696969696V69696969696969969696969696966969696969696V69696969696969969696969696966969696969696

5 0
3 years ago
Other questions:
  • On the CallCenterReport worksheet, add formulas that will summarize the issues for the department entered in cell B3. In cell B6
    13·1 answer
  • An essential skill today is knowing how to cite sources properly. Creative Commons has a system of licenses and tools for creato
    11·1 answer
  • The technique of ________ uses three columns that allows the entrepreneur to weigh both the advantages and the disadvantages of
    13·1 answer
  • Suppose a computer has 16-bit instructions. The instruction set consists of 32 different operations. All instructions have an op
    7·1 answer
  • Assume that the myname.txt file is currently closed. write the code segment that opens the file without erasing it, write anothe
    13·1 answer
  • What product category does the brand fit into?
    7·1 answer
  • A ________ provides quick access to context indicators, email, secure instant messaging, voice and video calling, conference cal
    10·1 answer
  • Someone wanna be in a meeting with me <br><br><br> Code: rrx-ofrw-ocj
    5·2 answers
  • Do u have to divide or multiply this problem 5300 yd = mi
    9·1 answer
  • 3. Output the following:<br>a.<br>21%4​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!