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
Which method do software testers use to isolate new code from the rest of the network during the test stage of the software deve
disa [49]

Answer:

Sandboxing.

Explanation:

SDLC or software development life cycle is a systematic approach to software development. It marks the birth and death of an application.

The application development starts from the research of the properties of the application to the design and development or implementation of the application.

After the implementation of the software, it is tested, comparing the design and the codes in the development process. The sandboxing testing process helps to isolate and test new lines of code added during the testing phase.

3 0
3 years ago
Hope fixes her mistake and comes up with this list.
Triss [41]

Answer:

C, D, E,

Explanation:

Use the header row option

Use the descending option

Use the Percentage field option

8 0
3 years ago
Read 2 more answers
___________ is an unsecured client server application / protocol that transfers files between two computers.
Alexus [3.1K]
It is known as the File Transfer Protocol or FTP. It is based on a customer server demonstrate design and uses isolate control and information associations between the customer and the server. FTP clients may conform themselves with an unmistakable content sign-in convention, regularly as a username and secret word, yet can interface namelessly if the server is designed to permit it.
6 0
4 years ago
Which tools would you use to make header 1 look like header 2.
Kamila [148]

The tools that would be used to make header 1 appear and look like header 2 is the alignment tool icon and the Bold tool icon.

To understand this question, we must understand the interface of the Microsoft Excel.

<h3>What is Microsoft Excel?</h3>

Microsoft Excel is a spreadsheet that can be used for a variety of features such as:

  • Computation of Data sets and variables
  • Calculation of Business Data
  • Arrangement and Analysis of Data into Tables etc.

As a Microsoft software, Microsoft Excel can also be used to edit sheets. In the image attached, the required tool icons needed to change the header 1 into header 2 is the alignment tool icon and the Bold tool icon.

The two tools can be seen in the image as the two lower left icons.

Learn more about Microsoft Excel here:

brainly.com/question/25863198

6 0
2 years ago
E-commerce creates a great deal of data on how consumers interact with a website. L.L.Bean keeps records that show how quickly c
Aleksandr [31]

Answer:

Evidence based decision-making

Explanation:

Evidence-based decision-making uses research as the backbone for making decisions. It ensures that proper investigations are done before any decision is made.

This decision making technique carries out an in-depth analysis of empirical data collected from targeted sources. The decisions made are based on the following type of evidence:

  1. Ethical evidence: research based on social justice to guide in making ethical decisions.
  2. Statistical modeling: using regression methods to make decisions in organizations.
  3. Impact evidence: making investigations based on the impact on others.
  4. Implementation evidence: considering the implementation and delivery success, after proper investigation.

L.L. Bean works with the records of how quick customers make decisions and whether they complete their purchase. This means that they suggest solutions based on the evidence retrieved from the data.

6 0
3 years ago
Other questions:
  • Which of the following Internet business models involves a merchant creating an online digital environment that enables people w
    11·1 answer
  • Only the _________ can add users with passwords and limit user access to selected areas.
    5·1 answer
  • What is batch processing?
    12·1 answer
  • Order the following list of functions by the big-Oh notation. Group together those functions that are big θ of one another.6nlog
    5·1 answer
  • What technology habit you practice every day that you need to stop to be more successful?
    13·1 answer
  • What is the purpose of a Macro in Word?: *
    13·1 answer
  • Consider a hypothetical hard drive that has 400,000 cylinders, 8 heads, and 128 sectors per track. Demonstrate, in writing, how
    9·1 answer
  • This is more a question for Brainly,
    5·2 answers
  • a) In an office, it is required to take hundreds of copies of the same type written document. Which traditional method of docume
    11·1 answer
  • Missing only a few days of school will not impact your grades.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!