Discussion in 'Hardware and Software' started by Dogling, 30 Sep 2017.
tbf in class we're just doing simple shit,
we haven't even done for / else loops yet.
i get to use a program called Fico XpressIVE next wek will be lots of... fun
For starters, please ensure that all your variables' names start with lowercase letters, Temp and Temperature look like class names.
Are you intending to skip over the first element in weatherData (it's possible you are since these sorts of datasets sometimes have headers describing the data)? Remember that the first element in Java arrays is at index zero and not one like in some other languages. I would take a minute to consider what the values of n and i will be as the loop runs and what these values represent.
Your last System.out.println is weatherData, that doesn't look right.
I wasn't talking about the index of each field of data within each line, I meant that out of your 1.36m entries, you're skipping the first one.
In your for loop, each iteration increases both n and i by one, why would your counter end up as the index with the lowest temperature once the loop is complete if all it does is increase by one each time?
Store n as something when you find a new minTemp and then print weatherData[something] after the loop
Also n should probably start at 0 and i shouldn't be there at all
Also would recommend deleting your question description when u get this solved just to be safe
I'm assuming since you've not asked anything further that you've got it working, but as an additional note I'd change the initial value of minTemp to a large positive value, say 100 for example. Otherwise in the event no station reports a temp below 0, you'd just be getting a minTemp of 0 which doesn't match with any station, rather than the actual minimum temp and station it was observed at.
Separate names with a comma.