Question 3 (Marks: 25)

The Sports Administration Management must manage each player’s performance and are
therefore required to review the players’ performance every six months. Points are earned as
follows: Three (3) points for each goal scored and two (2) points for a penalty.
The data below represents the performance of one player during the first six months of the year.
Use this data to populate the arrays.
Points 30 10 5 20 25 30
Month Jan Feb Mar Apr May Jun
Q.3.1 Write the pseudocode for an application that will generate a report that will show
the following information:
a. The total number of points the player scored during the first six months of
the year.
b. The average number of points the player scored per month.
c. The month during which the lowest number of points were scored by the
player.
d. The month during which the highest number of points were scored by the
player.
Note: You must use parallel arrays as part of your answer.

1 answer

1. Initialize the following arrays:
- points[6] // an array to store the points scored by the player each month
- month[6] // an array to store the names of the months

2. Read the values for points array and month array from the given data.

3. Calculate the total number of points scored:
- Initialize a variable totalPoints to 0
- Use a loop to iterate through each element in the points array
- Add the current element to totalPoints

4. Calculate the average number of points scored per month:
- Initialize a variable averagePoints to 0
- Divide totalPoints by 6 and assign the result to averagePoints

5. Find the month during which the lowest number of points were scored:
- Initialize a variable lowestPointsIndex to 0
- Use a loop to iterate through each element in the points array (starting from index 1)
- If the value at the current index is less than the value at lowestPointsIndex
- Update lowestPointsIndex with the current index

6. Find the month during which the highest number of points were scored:
- Initialize a variable highestPointsIndex to 0
- Use a loop to iterate through each element in the points array (starting from index 1)
- If the value at the current index is greater than the value at highestPointsIndex
- Update highestPointsIndex with the current index

7. Print the following information:
- The total number of points scored during the first six months: totalPoints
- The average number of points scored per month: averagePoints
- The month during which the lowest number of points were scored: month[lowestPointsIndex]
- The month during which the highest number of points were scored: month[highestPointsIndex]