Dogling's adventures into the lands of java.

Discussion in 'Hardware and Software' started by Dogling, 30 Sep 2017.

  1. tbf in class we're just doing simple shit,

    we haven't even done for / else loops yet.
     
  2. Jolly Long Arm The Moon... It's far away!

    i get to use a program called Fico XpressIVE next wek will be lots of... fun
     
  3. HEEEEELLLLLOOOOO

    [Solved]

    Thanks dudes
     
    Last edited: 28 Nov 2017
  4. Mysteryem The Dividing Line

    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[1135657], that doesn't look right.
     
  5. Mysteryem The Dividing Line

    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?
     
  6. 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
     
    • Agree Agree x 1
    • Useful Useful x 1
    • List
  7. Mole45 Dance Little Liar

    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.
     

Users Viewing Thread (Users: 0, Guests: 0)