using a for loop to read text from a file

I am wondering how to do an assignment for CS1. I am asked to read data from a txt file then output it to the screen. I am given a file that has the name of 78 weather stations, the elevation, and 12 numbers representing the monthly precipitation. I am supposed to use for loops to read this text and output the name, the elevation and the annual precipitation. I am new to programming and am really confused on how to even begin writing code using the for loop to read data from the file. an example of the given text file is attached along with how the information is to be displayed:
1
2
3
4
5
6
7
AGUA CANYON	8900 2.4 3.1 2.7 1.9 1.5 0.9 1.9 2.7 2.3 2.1 2.2 2.4
BEAVER DAMS	8000 2.9 2.8 3.4 3.4 2.2 0.9 1.1 1.7 1.9 2.4 2.7 2.7
BEAVER DIVIDE	8280 3.3 3.1 3.3 3.3 2.6 1.5 1.4 1.8 1.8 2.2 2.9 3.3
BEN LOMOND PEAK	8000 8.9 8.2 6.7 4.8 5 3 1.5 2.3 4 4.7 6.8 8.2
BEN LOMOND TRAIL	6000 5.7 5.3 4.5 3.5 3.7 2 1.1 1.7 2.7 3.8 5 5.5
BIG FLAT	10290 3.8 3.6 4 3.6 2.9 1.7 1.8 2.4 2.1 2.2 2.7 3.1
BLACK FLAT-U.M. CK	9400 1.9 2.1 2.3 2.1 1.8 1.1 1.8 2.1 1.8 1.8 1.8 1.8


1
2
3
4
Weather Station       Elevation  Precipitation
AGUA CANYON             8900        26.1
BEAVER DAMS             8000        28.1
BEAVER DIVIDE            8280        30.5


any tips would be helpful, thank you!
Topic archived. No new replies allowed.