title: Java: Calling variables of user input from one method to another
body: <p>I'm currently modifying a previous Java program that computes quadratic formula type math problems by breaking parts of my code down into methods and calling those methods to complete the same task. Currently I'm stuck on creating a method to calculate the discriminant in the numerator. As assigned, I'm supposed to have one method that receives user input for the a,b, and c values, but I'm not sure how to get those values from one method into the next that is supposed to use those values in calculations. </p>
  
  <p>My instructor wants us to have the a b and c variables input into an array and I know the way it is now is a pretty manual way of putting values into an array, but should still work for this purpose.</p>
  
  <p>Here is what I have thus far and thanks for reading.</p>
  
  <p><strong><em>EDIT</em></strong>: I've started again from scratch, I can't figure out how to properly return information from my methods so that the next can use it. I keep getting method argument not applicable errors. Any ideas?</p>
  
  <pre><code>import java.util.*;
  
  public class QuadraticMethods {
  public static void main(String[] args){
  
      getValues();
      calcDisc(userInput);
  
  
  
  }
  
  
  public static double[] getValues() {
      double[] userInput;
      userInput = new double[3];
      Scanner kbd = new Scanner(System.in);
      System.out.println("Fourth Assignment by MyNameHere");
      System.out.println("Welcome to the quadratic formula computation tool.");
      System.out.println("This tool will solve problems in the form of: a^x + bx + c.");
      System.out.println("Please enter the values you would like for a, b, and c.");
      for (int i = 0; i &lt; userInput.length; i++) {
          userInput[i] = kbd.nextDouble(); }
  
  
      double aValue = userInput[0];
      double bValue = userInput[1];
      double cValue = userInput[2];
      /*
      System.out.println(aValue);
      System.out.println(bValue);
      System.out.println(cValue);
       */
      return userInput;
  }
  
  
  public static double calcDisc(double[] userInput) {
      double aValue = userInput[0];
      double bValue = userInput[1];
      double cValue = userInput[2];
      double radicalValue = (Math.pow(bValue, 2) - (4*aValue*cValue));
      System.out.println(radicalValue);
      return radicalValue;
  }
  </code></pre>
  
  <p>}</p>