r/javahelp • • Nov 06 '19

Going crazy, need help with a program

Hi guys, I'm an ansipring java developer. My developer friend gave me an exercise and I can't for the life of me figure out how to do it. If you guys could help I would be so grateful.

This is the exercise:

Given a weather.dat file, write a program that given the file in input returns the day with the biggest and lowest temperature range. In this file there are 30 days and there's a lot of data for these days, but the temperature columns are the second and third one. So it's like : Day | Max Temp | Lowest Temp| ecc | ecc | ...

I understood I have to use Java Arrays and I managed to have the program read all the file but I don't know how to proceed. Help, thanks lol

16 Upvotes

13 comments sorted by

View all comments

1

u/juckele Barista Nov 06 '19

First, it's great that you've gotten as far as you have. I've had a lot of people ask me to teach them to program, and I can tell them to download a specific program, open it, and report back when they've done that. That step actually dissuades most people, so that you've written some code in a serious attempt to complete the task is fantastic!

That said, I honestly think you'd benefit from a slightly more formal introduction than "read this file and find the min and max values". The problem is that this is assuming you know how to work with arrays, loops, and logical statements all at once, and it's clear from your code that you don't have all of these skills yet. Practicing them all at once is leaving you lost, and I doubt it's a great approach for you.

I'd recommend that you grab a book that does a more structured introduction. I really like this one, which is free online, and structured really well: https://greenteapress.com/wp/think-java/

Go through the exercises at the end of each chapter, feel free to post here if anything stumps you, skip the grid world stuff.