An excercise in fustration

I thought long and hard about today’s task, I set out to make a task that appeared easy to complete but without the correct design would prove to be frustrating.
The task below has been broken down so you need to follow it from start to finish and constantly revisit “finished” parts of the program, this is the iterative nature of programming.

1. Design and create a program that
a. Stores 20 class marks before displaying them and displaying the average to one decimal place.
b. Change the design and program to validate the marks (between 1 & 100) using the supplied function.
c. Change the design and program to also store the names of the students and then display the output in a two column report.

I’ll post the (1c) solution up tomorrow after class, the code for the function is after the break.

Private Function GetValidNum(ByVal Min As Integer, ByVal Max As Integer) As Integer
‘this function returns a valid whole number between the MAX and MIN values
‘to use this function you must pass in MIN and MAX
‘ i.e. trial = GetValidNum(1, 100)
Dim IntNum As Integer
Dim SngNum As Single
Dim NumOK As Boolean
NumOK = False
Do
SngNum = InputBox(“Please enter a whole number between ” & Min & ” and ” & Max)
If SngNum >= Min And SngNum <= Max And SngNum = Int(SngNum) Then
NumOK = True
IntNum = SngNum
Else
MsgBox(“Number not valid”)
End If
Loop Until NumOK
Return IntNum
End Function