Given that you understand how to open/close the file and what it will look like.
You will need to loop through the file to get the city name and the 12 pieces of data which can be summed to a total as the loop progresses. Output the city name.(I'm assuming that this monthly rainfall will be presented as double type values) You can then calculate the yearly average and use the round() function to obtain the rounded integer.
Now output a '|' and this number of *'s on the same line as the city name.
Open the next file and repeat.