title: Transferring data from arrays to different methods
body: <p>I am a beginner programmer in Java. Recently I started to learn how to use multiple methods in a single code. Right now, I am trying to create a code that takes data from a user-input array and uses it in a separate method in order to find the average of the inputed values (I plan on adding more to the code, which is why there's a String array of names, but right now I want to fully understand my current issue before making the code more complex). This is the code I have so far:</p>
  
  <pre><code>import java.util.*;
  
  public class Example{
  
  
   public static double namesArray(){
      String[] names={"Employee A", "Employee B", "Employee C", "Employee D", "Employee E", "Employee F", "Employee G", "Employee H", "Employee I", "Employee J"};
   }
  
  
   public static double salesArray(){
      Scanner sc = new Scanner(System.in);
      double[] sales = new double[10];
      System.out.println("Enter the sales numbers, in dollars,  for each employee: ");
      for (int i = 0; i &lt; sales.length; i++){
          sales[i] = sc.nextDouble();
      }
  
      System.out.println(Arrays.toString(names));
      System.out.println(Arrays.toString(sales));
  
      return sales;
  
   }
   public static double getAverage(){
      double sum=0;
      for (int i = 0; i &lt; sales.length; i++){
      sum += i;
      }
      double average= sum/sales.length;
      return average;
   }
   public static void main(String[] args){
      namesArray();
      salesArray();
      average();
   }  
  }
  </code></pre>
  
  <p>But when I compiled, I encountered these issues:</p>
  
  <pre><code>Example.java:19: error: cannot find symbol
              System.out.println(Arrays.toString(names));
                                                 ^
  symbol:   variable names
  location: class LabFixing
  
  
  Example.java:22: error: incompatible types: double[] cannot be converted to double
              return sales;
                     ^
  
  Example.java:27: error: cannot find symbol
              for (int i = 0; i &lt; sales.length; i++){
                                  ^
  symbol:   variable sales
  location: class Example
  
  
  Example.java:30: error: cannot find symbol
              double average= sum/sales.length;
                                  ^
  symbol:   variable sales
  location: class Example
  
  
  Example.java:36: error: cannot find symbol
              average();
              ^
  symbol:   method average()
  location: classExample
  
  5 errors
  </code></pre>
  
  <p>I think the main problem I'm having is that I'm a bit unsure of how to pass arrays from one method to another. Any tips or advice would be greatly appreciated, thank you for your time.</p>