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
natali 33 [55]
4 years ago
6

"The main program will call a series of methods to process a set of data. One method will read data into an array. A second meth

od will print the values stored in an array in a neat format. Another method will find the average of the values stored in an array. A fourth method will construct a new array from an existing array."
Computers and Technology
1 answer:
saw5 [17]4 years ago
4 0

Answer:

Check the explanation

Explanation:

import java.util.*;

import java.io.File;

public class Main

{

 

public static void main(String[] args) {

           

double[] second = new double[10];

double[] arr = new double[10];

arr = readData(10,arr);

     

System.out.println("here is the original array");

     

printArray(3,arr);

double avg = findAverage(5,arr);

System.out.println("The avearage value is" + avg);

System.out.println("here is the new array");

     

second = howFarAway(9,avg,arr,second);

     

printArray(3,narr);

     

avg = findAverage(5,narr);

System.out.println("The avearage value is" + avg);

 

}

public static double[] readData(int n,double[] numbers)

  {

 

      File file = new File("number.txt");

Scanner fileScanner = new Scanner(file);

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

          numbers[i]=fileScanner.nextDouble();

 

  return numbers;

 

  }

 

public static void printArray(int q, double[] numb)

 

  {

 

      for(int i=0;i<numb.length;i++)

 

      {

 

          System.out.print(numb[i]);

          System.out.print(" ");

 

          if((i+1)%q==0)

              System.out.println("");

 

      }

  }

 

public static double findAverage(int k ,double[] p)

 

  {

  double s=0;

 

  for(int i=0;i<k;i++)

  s = s+p[i];

 

  return s/k;

 

  }

public static double[] howFarAway(int m,double avg,double[] arr,double[] narr)

 

  {

 

      for(int i=0;i<arr.length;i++)

  narr[i]=arr[i]-avg;

 

      return narr;

 

  }

}

You might be interested in
5(x + 4) = 4(x -6) |<br><br><br>How to do this problem
vichka [17]
5 ( x + 4 ) = 4 ( x - 6)
5x + 20 = 4x - 24
5x -4x + 20= 4x - 4x - 24
1x + 20 = -24
1x + 20 - 20 = -24 - 20
1x = -44

check

5 (-44 + 4) = 4 ( -44 - 6)
5 (-40) = 4 (-50)
-200 = -200
3 0
3 years ago
The following shared data structures must be declared as global variables such that they are shared by all threads
Elena L [17]

Answer:

what the heck

Explanation:

4 0
3 years ago
If you Buy my group clothing in R.o.b.l.o.x for a donation i will make you brainliest
erastova [34]

Answer:kk ima do it

Explanation:

7 0
3 years ago
Read 2 more answers
What happens when the programmer tries to access an array cell whose index is greater than or equal to its logical size?
just olya [345]

Answer:

When a programmer tries to access an item in an array cell whose index is greater than or equal to the array's logical size, this data element or item is garbage. This means that currently, the item is not the part of the program's useful data. Garbage contains objects or data which will not be used by a program running on it. So the value returned could be either of the two:

  • Value would be an arbitrary or random number if it is an array of numbers. Arbitrary means that the value is not predefined or specified in advance.
  • Value returned would be null if it is an array of objects.

                                                           

 

3 0
3 years ago
When do we use an if- statement ​
wel

Answer:

You'd use an if statement if something happens. What I mean is that {If this happens} Then that happens but if the if doesnt happen then the then doesnt happen

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • Match each storyboarding technique with its appropriate description
    9·1 answer
  • What will be a fundamental aspect of future games??
    12·2 answers
  • A. True
    8·2 answers
  • Given a computer running four types of instuctions, named classes A through D, calculate the execution time of a program that ha
    5·1 answer
  • Suppose two hosts, A and B, are separated by 15,000 kilometers and are connected by a direct link of R = 5 Mbps. Suppose the pro
    11·1 answer
  • Write a program that prompts the user to input five decimal numbers. The program should then add the five decimal numbers, conve
    5·1 answer
  • Hey, how is everyone????????????????????????????????
    8·2 answers
  • Johnathan was assigned to complete a project with three other people. What benefit will he get from working with the team?
    15·1 answer
  • Identify 5 products/services needed by the people in our current situation.<br>​
    6·1 answer
  • ________ are the symbolic codes used in assembly language?​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!