It should read values from the input line alternately into xVal and yVal until a negative value is read or until greater than 2∗maxPoints
are read. which returns an int numPoints.
output needs to be shown in the format:
Having trouble figuring out how to read into ALTERNATE arrays. Thank you
Parallel arrays? Loading the arrays via a static method? Both those things look like iffy design to me. Who told you to use that sort of design?
I would give such a method void instead of a return type. And why do you need a parameter for number of points? Can't you get that from the two arrays? Throw an exception if the two arrays aren't the same size.
It is easy enough to get a double from a Scanner with its nextDouble() method, but make sure you only write numbers. Maybe you could display this sort of thing:-
Next 2 numbers please: 123.45 234.56
Next 2 numbers please: 345.67 456.78