Question: For this exercise create a new version of the rainfall examples in this chapter. This new version should use a loop to read the monthly

For this exercise create a new version of the rainfall examples in this chapter. This new version should use a loop to read the monthly rainfall from the rainfall2007.txt file, accumulate the total rainfall for the first 3 and last 3 months of the year (6 months altogether), and also display the name of the month and monthly rainfall for each of these 6 months. You don't need to use a table although you can if you'd like to. The results should be something like this:
JAN: 3.21
FEB: 3.61
MAR: 2.84
OCT: 0.52
NOV: 2.03
DEC: 2.20
Total Rainfall for these months: 14.41 inches.
rainfall2007.txt:
3.21
3.61
2.84
1.06
0.16
0.04
0.02
0.11
0.45
0.52
2.03
2.20
HINT: Review the first four rainfall examples in the chapter. You may find it useful to copy some of the code in these files (in your samples folder) into rainfall-report.php. Of course you will need to modify the code to meet these new requirements. Each time the loop repeats a new rainfall amount is read from the file. Consider carefully what you need to do inside the loop, remember that you must print the name of each month and the amount, and also accumulate the total, but only for the first 3 and last 3 months.
For this exercise create a new version of the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!