10Two Dimensional ArraysHard15 marks
Five rivers show signs of pollution and are to be monitored daily for a period of 30 days.
The one-dimensional (1D) array RiverNames[] stores the names of the rivers.
The two-dimensional (2D) array RiverStats[] stores the daily measurement of biological oxygen demand (BOD) for each river.
The two-dimensional (2D) array DaysCount[] stores the number of days each river is classed as moderately polluted and the number of days each river is classed as highly polluted.
The position of the data for any river is the same in all three arrays. For example, the data in index 2 of RiverStats[] belongs to the river in index 2 of RiverNames[]
Write a program for the following requirements:
• Input and store the names of the rivers in the array RiverNames[]
• For each river, input and store in the array RiverStats[], the daily BOD in milligrams per litre (mg / L) on each of the 30 days.
• Once all the inputs for the 30 days have been completed, the following statistics are calculated, and when appropriate, stored:
◦ The average daily reading for each river, rounded to two decimal places.
◦ The number of days in which the BOD reading was between 2 mg / L and 8 mg / L inclusive (moderate pollution) for each river.
◦ The number of days in which the BOD reading was greater than 8 mg / L (high pollution) for each river.
• Output for each river, the average daily BOD readings, the number of days with moderate pollution and the number of days with high pollution.
• Find and output the name of the river that has the most days with high pollution.
The program does not need to identify more than one river with an equally high pollution reading.
You must use pseudocode or program code and add comments to explain how your code works.
Do not declare arrays, variables or constants for this algorithm; assume this has been done.
You will need to initialise the arrays and any variables used for counting or totalling before they are used.
All inputs and outputs must contain suitable messages.
Answer
0 words