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
Romashka [77]
3 years ago
11

Create a new Java project/class called ChangeUp. Create an empty int array of size 6. Create a method called populateArray that

will pass an array, use random class to choose a random index and prompt the user to enter a value, store the value in the array. Note: Generate 6 random index numbers in an attempt to fill the array. Create a method called printArray that prints the contents of the array using the for each enhanced loop. Submit code. Note: It is possible that your array won't be filled and some values will still have 0 stored. That is acceptable.
Computers and Technology
1 answer:
-Dominant- [34]3 years ago
3 0
<h2>Answer:</h2><h2></h2>

//import the Random and Scanner classes

import java.util.Random;

import java.util.Scanner;

//Begin class definition

public class ChangeUp {

   

   //Begin the main method

  public static void main(String args[]) {

       //Initialize the empty array of 6 elements

      int [] numbers = new int [6];

       

       //Call to the populateArray method

       populateArray(numbers);

       

       

   } //End of main method

   

   

   //Method to populate the array and print out the populated array

   //Parameter arr is the array to be populated

   public static void populateArray(int [] arr){

       

       //Create object of the Random class to generate the random index

       Random rand = new Random();

       

       //Create object of the Scanner class to read user's inputs

       Scanner input = new Scanner(System.in);

       

       //Initialize a counter variable to control the while loop

       int i = 0;

       

       //Begin the while loop. This loop runs as many times as the number of elements in the array - 6 in this case.

       while(i < arr.length){

           

           //generate random number using the Random object (rand) created above, and store in an int variable (randomNumber)

           int randomNumber = rand.nextInt(6);

       

           //(Optional) Print out a line for formatting purposes

           System.out.println();

           

           //prompt user to enter a value

           System.out.println("Enter a value " + (i + 1));

           

           //Receive the user input using the Scanner object(input) created earlier.

           //Store input in an int variable (inputNumber)

           int inputNumber = input.nextInt();

           

           

           //Store the value entered by the user in the array at the index specified by the random number

           arr[randomNumber] = inputNumber;

           

           

           //increment the counter by 1

          i++;

           

       }

       

       

       //(Optional) Print out a line for formatting purposes

       System.out.println();

       

       //(Optional) Print out a description text

      System.out.println("The populated array is : ");

       

       //Print out the array content using enhanced for loop

       //separating each element by a space

       for(int x: arr){

           System.out.print(x + " ");

       }

   

       

  } //End of populateArray method

   

   

   

} //End of class definition

<h2>Explanation:</h2>

The code above is written in Java. It contains comments explaining the lines of the code.

This source code together with a sample output has been attached to this response.

Download java
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> java </span>
0d7446bcb6b48f78b8adbfa3da89789c.png
You might be interested in
2min speech on can teachers be replace by technology​
elena-s [515]

Answer:

The boom of online courses, where anyone can learn from the comfort of one’s own home or office at their own chosen time is the main cause. When online courses made their foray a decade ago, the same question of technology replacing teachers in schools emerged as a major argument. However, if we ask you today whether calculators can replace mathematics teachers at school, what would you say? Sounds weird, right! Do you think calculators which are also a kind of a technological advancement only, are capable enough of themselves, so as to replace the teachers? The answer is obvious. It’s an obvious No!

6 0
3 years ago
What is the biggest danger when you reveal information such as your Social Security number?
Dima020 [189]

based off my knowledge im gonna to go with OPTION A because ur social security number holds information like your brith etc

6 0
3 years ago
Read 2 more answers
An online game is played with two dice. In this context, explain what is meant by decomposition.
Vlad [161]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

This question is about desinging a game that is played with two dice and gets or shows their value to the player.

The dice value is random, and it can be between one and six. So, you need to generate two numbers between 1 and 6. You may also need to display the numbers

The main part of this program is that you need to know the numbers to limit or restrict what the user may do next while playing.

That's most of the first level of decomposition for solving a problem. In decomposition, you need to keep decomposing (breaking) the problem into smaller pieces, thinking outline of the program and deciding what objects, functions, variables, and logic you're going to implement in the coding.

4 0
3 years ago
2. What is data, information, knowledge and data Science? Define the role of data in emerging technology? ​
xz_007 [3.2K]
Answer :
Before answering the question. We look to it in your real life. The minute you wake up and open your eyes, your eyes collect all the information of the room you are in and your brain segregates them depending on the need. So that once you recall that memory it will be already saved in your brain. So your brain is like a computer.
You are collecting data ( information ) of what ever you hear , look and even imagine all day. For extra knowledge, when you put that memory into a form of ( writings , or art if you were an Arabist ) it’s called data visualization.
You are now the data scientist, you collected information form all the surroundings and it’s up to you to display it the way you want but that data must be correct
——
To the real short cut answer

Data , The data is information that is being stored by a computer. This data may be in the sort of text, images, audio clips, software applications, or other varieties of data


Information , information is a term used to describe text that is informative to the individual reading it or the computer processing it.

Or

Information is defined as knowledge gained through study, communication, research, or instruction. Essentially, information is the result of analyzing and interpreting pieces of data. Whereas data is the individual figures, numbers, or graphs, information is the perception of those pieces of knowledge.

Knowledge, In information technology, knowledge is, to an enterprise or an individual, the possession of information or the ability to quickly locate it.


Data science, Data science is the field of applying advanced analytics techniques and scientific principles to extract valuable information from data for business decision-making, strategic planning and other uses.

Your final answer is : Data has the potential to drive better outcomes, processes and of course, new technology that could be the next major industry disruption and breakthrough.”

5 0
2 years ago
Within the manufacturing industry, there are fourteen subindustries. Which of the
inna [77]

Answer: A or B i done this before but my memorys quite blurry i rekon doing A

Explanation:

3 0
2 years ago
Other questions:
  • Which of the following jobs are most likely to be in greater demand due to the increasing prevalence of mobile computing? deskto
    13·1 answer
  • SELECT vendor_name, COUNT(*) AS number_of_invoices, MAX(invoice_total - payment_total - credit_total) AS balance_due FROM vendor
    15·1 answer
  • Which is a common problem caused by the widespread use of computers?
    7·1 answer
  • What important practice can help prevent hardware trouble?
    6·1 answer
  • When you gather primary or secondary data, what part of the market information management process are you participating in?
    8·1 answer
  • In addition to the decimal number system, the number systems used most often in PLC operationand programming are ________.
    9·1 answer
  • Adjust list by normalizing When analyzing data sets, such as data for human heights or for human weights, a common step is to ad
    7·1 answer
  • Complete the following sentence.
    7·1 answer
  • Which type of backup ensures you capture a complete snapshot of everything that makes your computer run?.
    10·1 answer
  • What special enterprise VPN supported by Cisco devices creates VPN tunnels between branch locations as needed rather than requir
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!