Need some basic method advice please
This is my first (and hopefully last) question I’ve asked here.
Should also add that I’m not looking for anyone to do my assignment for me, I’m actually only looking for advice on what type of method/array i should be investigating in one particular part of the code - so no ‘rtfm’ comments if that’s ok because I’ve spent the last 2 days trying that
Ok so here is it. I’ve been asked to take an old sequential program that I previously made, and break it up into 2 methods and 1 main.
1.) The first method should prompt and read 3 values, e.g:
“Enter size of blah”;
“Enter size of blah2”;
“Enter size of blah3”;
(It will also use a while loop to check for invalid data, but that’s not important right now).
2.) The second method calls the values entered in the first method and applies some maths to them.
3.) The main then (presumably) calls the results and prints them to screen in the same fashion that it previously did.
Now, i know how to make basic void methods and call them and i know how to make basic returning methods – but they were only doing simple addition. And it seems that every methods tutorial i’ve read only deals with single values being called and not 3.
This is where i’m stuck: assuming method one needs to return 3 values to the second method – then what kind of method should i be using? I’ve tried ‘return blah1;’ but I assume a returning method can only return one value and not three? Should they be returning methods or am I missing the point completely and should be using an array.
Assuming any of that made sense, any advice would be welcome :)
Thanks for your time,