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
solmaris [256]
4 years ago
12

Create a static method called fillArray, which takes an integer array as an input parameter, along with an integer initial value

. It should then fill the array with values starting from the initial value, and counting up by 1s. For example, if the data array has length 5, and if the initialValue is 3, then after execution the array should hold this sequence: 3 4 5 6 7. public static void fillArray (int[] data, int initialValue) {
Computers and Technology
1 answer:
JulijaS [17]4 years ago
3 0

Answer:

public class print{

   

   public static void fillArray(int[] arr, int initialValue){

       

       int n = arr.length;

      for(int i=0;i<n;i++){

          arr[i] = initialValue++;

      }

       for(int i=0;i<n;i++){

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

      }

       

   }

    public static void main(String []args){

       

        int[] array = new int[5];

        int initialValue =3;

       

        fillArray(array,initialValue);

       

    }

}

Explanation:

Create the function with two parameter first is array and second is integer.

Then, declare the variable and store the size of array.

Take the for and fill the array from the incremented value of initialValue  by 1 at every run of loop.

After loop, print the element of the array.

Create the main function which is used for calling the function and also declare the array with size 5 and initialValue with 3. After that, call the function with this argument.

You might be interested in
A _____ miniature battery operated transmitter that can be propelled through a non-metallic pipe or purpose of locating
Anna11 [10]
I think it is the model ET-2. Not quite sure.
7 0
3 years ago
________ feature full-time monitoring tools placed at the most vulnerable points, or "hot spots", of corporate networks to prote
Blizzard [7]
Intrusion Detection Systems feature full-time monitoring tools placed at the most vulnerable points, or "hot spots", of corporate networks to protect against suspicious network traffic and attempts to access files and databases. It  <span>generates an alarm if it finds a suspicious or anomalous event. </span>
4 0
3 years ago
Write a statement that defines an ifstream object named inputFile and opens a file named "Friends.txt".
Simora [160]

Answer:

ifstream inputFile;

inputFile.open("Friends.txt");

Explanation:

Though, the programming language is not stated, questions like this are often from C++.

The first statement defines the ifstream object using the following syntax.

ifstream [object_name]

In this case, the object name is inputFile

So, the syntax becomes

ifstream inputFile;

The next line opens a file using the following syntax.

[object_name].open("Filename")

Here, object_name is inputFile and filename is Friends.txt

So, the open statement becomes

inputFile.open("Friends.txt")

5 0
3 years ago
Which of the following set of instructions defines an algorithm in the formal, strict sense?
Nikolay [14]
Hope that understands

8 0
3 years ago
True or false? Opinionated websites can still be credible. A. True B. False
kumpel [21]
False. the information should not be biased in order to be creditable
5 0
4 years ago
Read 2 more answers
Other questions:
  • Which of the following is a good choice to help you stay organized when you are away from the office? A. Personal Information ma
    7·1 answer
  • If you can log into a website to add, edit, or delete content that has been added by you or another user, you are most likely us
    6·1 answer
  • Write a Twitter class that sets the Twitter user first (who is to be followed) and lets the client add up to 5 followers, which
    10·1 answer
  • Which element is included in the shot breakdown storyboard? Which element is included in the shot breakdown storyboard?
    8·1 answer
  • Who tryna play among us
    8·2 answers
  • Which statement describes Augmented Reality (AR) technology?
    12·1 answer
  • Task 1: Alex has created the following code using Scratch and expected it to move backwards and forwards across the screen. Howe
    13·1 answer
  • Write the corresponding Python assignment statements:
    13·1 answer
  • Why would a business consider using virtual machines?
    12·1 answer
  • When users connect to the network, they use a basic hardware terminal to access a desktop hosted on a virtualization server. wha
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!