1

Hello all I am in need of some help with getting a users input with double[] getUserInput().

I know how to get a users input and storing it, but I do not know how to do it with a array and I have to use double[] getUserInput(). Can someone explain to me how to set this particular code up "double[] getUserInput()", and what it does?

I'm supposed to Store the user provided values into an array of doubles, and return this array to the main method.

3
  • 1
    What language are you working in? Commented Apr 7, 2015 at 3:20
  • a) What language are you doing this in? b) Have a look at the first sample program ArrayDemo here to see how you can assign values to array elements. You might not be using Java but it's usually the same in other languages. Maybe. Commented Apr 7, 2015 at 3:23
  • Sorry I'm working with JAva. Commented Apr 7, 2015 at 3:24

1 Answer 1

1

Sample code to return double array

    public double[] getUserInput(){
       double[] userinput = {/*double values separated by comma*/};
       return userinput;
    }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.