needed objects:
object StudentCourseRequest is
description: (* *)
components: student_ID:string and title:Title and qrtr:Quarter;
end StudentCourseRequest
object Quarter is
description: (* *)
components: season:Season and year:integer;
end Quarter
object Season is Winter or Spring or Summer or Fall;
object StudentCourseComment is
description: (* *)
components: student_ID:string and title:Title and comment:string;
object StudentCourseRequestDB is StudentCourseRequest*;
object StudentCourseCommentDB is StudentCourseComment*;
operation AddStudentCourseRequest is
inputs: rDB:StudentCourseRequestDB, r:StudentCourseRequest;
outputs: rDB':StudentCourseRequestDB;
pre: (* The student may not already have a course request for
this course in the database for the selected quarter*)
NOT ((exists rec in rDB) (rec.student_ID = r.student_ID and rec.comment = r.comment);
post:
rDB' = rDB + r;
end AddStudentCourseRequest;
operation AddStudentCourseComment is
inputs: rDB:StudentCourseCommentDB, r:StudentCourseComment;
outputs: rDB':StudentCourseCommentDB;
pre: (* The student may not already have a course request for
this course in the database for the selected quarter*)
NOT (exists r in rDB);
post:
rDB' = rDB + r;
end AddStudentCourseComment;
operation ViewStudentCourseRequest is
inputs: rDB:StudentCourseRequestDB, r:StudentCourseRequest;
outputs: rDB':StudentCourseRequestDB;
pre: (* The student may not already have a course request for
this course in the database for the selected quarter*)
NOT (exists r in rDB);
post:
rDB' = rDB + r;
end ViewStudentCourseRequest;
operation ViewStudentCourseComment is
inputs: rDB:StudentCourseCommentDB, r:StudentCourseComment;
outputs: rDB':StudentCourseCommentDB;
pre: (* The student may not already have a course request for
this course in the database for the selected quarter*)
NOT (exists r in rDB);
post:
rDB' = rDB + r;
end ViewStudentCourseComment;