Write the pseudocode for the scenario below.

A teacher has a class of 10 learners who recently wrote a test. The teacher would like to store both the
learner’s name and their test mark in an array. However, this is not possible because their names are in
string format and their marks are numeric. Different data types cannot be stored in one array. This means
that you need to have two parallel arrays. One array will store the learner’s names and the corresponding
elements in the other array will be their marks. Verify that the marks input are between 0 and 100. Any
mark input outside of this range, the user must input the mark until it is within the range.
The values below are an example of the names and marks in the array for this scenario and explanation.
Use the values that the teacher will input and not those below.
Example Data
Names - string Marks - numeric
Joe 68
Mpho 56
Kyle 43
Susan 49
Thando 76
Refilwe 80
John 50
Katlego 75
Joyce 63
Sisanda 44
You are required to do the following for the teacher:
• Display the entire class’ names with their corresponding mark and result category.
o Any learner with a mark equal to or above 75 display “Distinction” next to their mark.
o For those learners with a mark less than 50, display “Fail”.
o All the other students must have the word “Pass” next to their mark.
• Calculate and display the average class mark.
• Create a module called “High” which does the following:
o Display the name of the learner with the highest mark.

BEGIN

DECLARE names[10] AS string // array to store learner names
DECLARE marks[10] AS numeric // array to store learner marks
DECLARE i as integer // variable to use as iterator

FOR i = 0 to 9
DISPLAY "Enter name for learner ", i+1
READ names[i]
WHILE marks[i] is not between 0 and 100
DISPLAY "Enter marks for learner ", i+1
READ marks[i]
END WHILE
END FOR

// display class' names, marks, and result category
FOR i = 0 to 9
DISPLAY names[i], " ", marks[i]
IF marks[i] >= 75
DISPLAY " Distinction"
ELSE IF marks[i] < 50
DISPLAY " Fail"
ELSE
DISPLAY " Pass"
END IF
END FOR

// calculate and display average class mark
DECLARE average as numeric
DECLARE total as numeric
FOR i = 0 to 9
total = total + marks[i]
END FOR
average = total / 10
DISPLAY "Average class mark: ", average

// module to display learner with highest mark
MODULE High
DECLARE highestMark as numeric
DECLARE highestName as string
highestMark = marks[0]
highestName = names[0]
FOR i = 1 to 9
IF marks[i] > highestMark
highestMark = marks[i]
highestName = names[i]
END IF
END FOR
DISPLAY "Learner with highest mark: ", highestName, " (", highestMark, ")"
END MODULE
END

Here is the pseudocode for the given scenario:

1. Create two empty arrays to store the learner's names and marks.
2. Create a loop to input the names and marks of the learners.
3. Inside the loop, prompt the teacher to enter the name and mark for each learner.
4. Validate the mark entered by the teacher:
a. If the mark is outside the range of 0 to 100, prompt the teacher to enter a valid mark.
5. Add the name and mark entered by the teacher into the respective arrays.
6. Exit the loop once all the names and marks have been entered.
7. Create a loop to iterate through the arrays and display the names, marks, and result category for each learner:
a. Inside the loop, check the mark of each learner:
i. If the mark is equal to or above 75, display "Distinction" as the result category.
ii. If the mark is less than 50, display "Fail" as the result category.
iii. For all other marks, display "Pass" as the result category.
b. Display the learner's name, mark, and result category.
8. Calculate the average class mark by summing up all the marks in the array and dividing by the total number of learners.
9. Display the average class mark.
10. Create a module called "High" to identify the learner with the highest mark:
a. Set a variable "highestMark" to 0.
b. Set a variable "highestMarkIndex" to -1.
c. Create a loop to iterate through the marks array:
i. Inside the loop, check if the current mark is greater than the "highestMark":
1. If true, update the "highestMark" with the current mark.
2. Update the "highestMarkIndex" with the index of the current mark.
d. Display the name of the learner at the "highestMarkIndex" position in the names array.

Here is the pseudocode for the given scenario:

```
// Step 1: Initialize arrays to store learner names and marks
names <- empty array of strings with size 10
marks <- empty array of integers with size 10

// Step 2: Prompt the teacher to input the names and marks of the learners
for i from 0 to 9:
repeat:
input name from the teacher
input mark from the teacher
until mark is between 0 and 100 (inclusive)
names[i] = name
marks[i] = mark

// Step 3: Display the entire class' names, marks, and result category
for i from 0 to 9:
result <- if marks[i] >= 75 then "Distinction" else if marks[i] < 50 then "Fail" else "Pass"
display names[i], marks[i], result

// Step 4: Calculate and display the average class mark
sum <- 0
for each mark in marks:
sum <- sum + mark
average <- sum / 10
display average

// Step 5: Create a module called "High" to display the name of the learner with the highest mark
maxMark <- 0
maxIndex <- -1
for i from 0 to 9:
if marks[i] > maxMark:
maxMark <- marks[i]
maxIndex <- i
display names[maxIndex]
```

Note: This pseudocode assumes that the input from the teacher is well-formatted and valid, and the input range is inclusive of both the lower and upper bounds.