This question is related to the
Answer
Grade
Thanks very much for your help!
So I've done this so far:
Marks:=proc(m::nonnegative, numeric)
if m < 40 then print (m, Fail)
elif m < 50 then print (m, `Third Class`)
elif m < 60 then print (m, `Lower Second Class`)
elif m < 70 then print (m, `Upper Second Class`)
elif m < 100 then print (m, `First Class`)
elif m > 100 then print (`error`)
end if;
end proc;
proc(m::nonnegative, numeric) ... end;
Marks(30);
30, Fail
Marks(40.9);
40.9, Third Class
Marks(One);
Error, invalid input: Marks expects its 1st argument, m, to be of type
nonnegative and numeric, but received One
The error above shows that the procedure understood that numeric
values were the only values to be considered therefore showed an error.
Marks(-3);
Error, invalid input: Marks expects its 1st argument, m, to be of type
nonnegative and numeric, but received -3
Again, another example to show that this particular procedure will only
take nonnegative and numeric numbers.
Marks(59.8);
59.8, Lower Second Class
Marks(101);
`error`
Not quite sure how to do this part:
If the mark is within 3 marks of the interval’s upper bound, a statement
should be added indicating that the grade is ‘borderline’.