In a java program, you start in the main() method. So, we'd start on your line 8, make the Scanner, create some variables...
Then we prompt the user and get some inputs...then when we hit the closing bracket on line 19, your program ends. you need to call the MainMin method in your main method, and save what it returns in a new variable, then print it out from there. Your current line 50 is not in any method, and is therefore not valid.
Further...I'm not sure why your MainMin takes four parameters. You only need to pass it three, and then you return the min value as your output on line 44. You will have to declare output as a local variable in your method, but that's trivial...
jay hill wrote:SO how do I call the method in main?
You already know how to call a method. On lines 13 - 18 you call the the println and nextInt methods. So just try doing something similar with your MainMin method.
jay hill wrote:once I call it, I then store the return as a double, then print the final line?
Correct. As Fred said, you'll need to move your print statement inside the main method.
There is no need for MainMin to take the "output" double as a parameter. In general, you should never re-assign the value of a method argument.
There is a much simpler way to determine the lowest value:
If you have studied loops and arrays, you can make this even simpler.
jay hill wrote:Thank you for all the help, I appreciate it. One more thing. What is my instance when I call the method?
It's a static method, so you don't need an instance:
If you were outside the class, you'd qualify it by using the class name:
but there's no need for that when you're still in the same class.
AS WRITTEN, your MainMin method requires you to pass it four parameters. But you really shouldn't write it that way. You don't need to pass IN the outPut variable. I would delete it from line 21.
Then, inside your MainMin method, you need to declare it...before your first if-statement, you would need a line like
double output = 0;
jay hill wrote:What would my arguments be? My inputs?
Think about what your method is doing...you pass it three values, and it returns the minimum. So, pass it whatever three values/variables you want to find the minimum of. In this case, your inputs is indeed what you want to pass it.
Note also that when you pass them in, you don't need to state what the type is...you just list them.