My computer science teacher wants us to take in input from a textfile that displays rain from a city and a city name, then add together the rain from each city and output it. The text file looks like this 15.1,Chico,17.4 34.4,Seattle,30.5
22.9,Portland,26.1
12.3,New York,9.4
.5,Death Valley,1.1
3,Las Vegas,13.8
60,Alajuela,54.3
17.3,San Francisco,20.3
29.5,Dublin,30.8
except all these cities and names are on one line. Anyways I kind of get how to input the text but not fully.
all I'm trying to do is first printout the first line correctly. So add the two rainfall averages for the first and second year of the line that says Chico, then print out both of them added together along with the name to the left of it. Kind of like this
Chico 32.5
I'm having trouble though figuring out how to get the first number in this line and then skip over the "chico" and then continue to reading the second number given.