type string == list(char); type student == string X string; type class == list(student X num); c:class; c <= [(("Fred","Jones"),66),(("Ali","Mohamed"),76),(("Mary","Ward"),92),(("Colin","Gold"),31)]; c; type course == string X class; c1: course; c1 <=("CS1", c); c2: course; c2 <=("Maths", [(("Fred","Jones"),36),(("Ali","Mohamed"),56),(("Mary","Ward"),45),(("Colin","Gold"),71)]); type degreeprogramme == list(course); cs:degreeprogramme; cs <= [c1,c2]; cs;
allStudentsInClass:class -> list(student)
which returns all students in a class.
allStudentsOnCourse:course -> list(student)
which returns all students on a course.
allStudentsOnDegreeProgramme:degreeprogramme -> list(student)
which returns all students on a degree programme. The easiest way to do it is to append the list of students on each course together
and then remove duplicates.
bestStudentInClass:class -> student
which returns the best student
in a class.
For example bestStudentInClass(c)
should return ("Ali","Mohamed")
.
bestStudentInCourse:course -> student
which returns the best student
on a course.
For example bestStudentInCourse(c1)
should return ("Ali","Mohamed")
.
bestStudents:degreeprogramme -> list(string X student)
which returns a list
of the best students on each course in a a degree programme.
For example bestStudents(cs)
should return [("CS1",("Ali","Mohamed")),("Maths",("Colin","Gold"))]
.
average1:degreeprogramme -> list(string X num)
which returns a list
of the average marks for each course.
For example average1(cs)
should return [("CS1",65.25),("Maths",52)]
.
average1:degreeprogramme -> list(student X num)
that list all students together with there average mark on a degree programme. This function should be sorted in descending order of average mark.
s.danicic@gold.ac.uk