module TestAdminister; from TestGeneration import Test, ClassTaken, Section; from StudentInterface import Student, StudentInfo; from TestGrading import Mean, Median, Mode; from QuestionModule import Answer, QuestionText, ClassName; export Class, ClassList, ClassTests, TestView, QuestionView, CurrentQuestion, TeacherView, Status, Time, Roster; -- OBJECTS obj Time is components: hours:Hour and minutes:Min and seconds:Sec; description: (* The time that counts down for the instructor's view *); end Time; obj Hour is integer; obj Min is integer; obj Sec is integer; obj Name is string; obj TotalTime inherits from Time; obj Class is components: roster:Roster, classname:ClassName, Quarter, Year, Teacher; description: (* Represents one class that will be taking the test *); end Class; obj CourseNumber is integer; obj Quarter is string; obj Year is integer; obj Teacher is string; obj ClassList is Class*; obj Roster is components: StudentInfo*; description: (* A collection of students with records of each students user name and password. Only the students listed on a roster can take an in class test. *); end Roster; obj ClassTests is components: t:Test*, Mean, Median, Mode, ClassTaken; description: (* A collection of tests for a class. Used when an in class test is taken *); end ClassTests; obj TestView is components: n:Name, qv:QuestionView*, cur:CurrentQuestion, stat:Status, t:Time,on:OpenNote; description: (* The TestView object describes what the student sees when taking a test. It consists of: a window displaying one QuestionView at a time, below each question are buttons to skip to the first, prev, next or last question as well as a submit button. The time remaining is also displayed in the TestView. *); end TestView; obj QuestionView is components: qt:QuestionText, answer:Answer; description: (* the QuestionView object displays the QuestionText and the area to answer. *); end QuestionView; obj CurrentQuestion is integer; obj Status is string; obj OpenNote is boolean; obj TeacherView inherits from TestView components: roster:Roster; description: (* Represents the teacher's administration view *); end TeacherView; obj TakingEnvir is components: tv:TestView*, app:Application*; description: (*An in-class taking environment *); end TakingEnvir; obj Application is string; -- TEST ADMINISTERING OPERATIONS op SelectClass inputs: cn:ClassName, cl:ClassList, tev:TeacherView; outputs: c:Class; pre: (* There is a c with a cn in cl *) exists (c in cl) (c.classname) = cn; post: (* TeacherView displays Roster *) tev.roster = c.roster; description: (* The program will show the class roster in the class window *); end SelectTest; op BeginTest is inputs: t:Test, tv:TestView*; outputs: tv':TestView*; pre: (* tv.Status = "unbegun" *) forall (tv:TestView) tv.stat = "unbegun"; description: (* The selected test will appear on each students screen and the time will begin *); end BeginTest; op EndTest is inputs: tv:TestView*, ct:ClassTests, t:Test*; outputs: ct':ClassTests; pre: (* test status is not submitted *) forall (tv:TestView) tv.stat != "submitted"; post: (* exists (t:Test in ct') for (i = [1 ... #tv.qv]) (t.aq[i].text = tv.qv[i].qt) *); description: (* The test or tests will be collected and stored as Tests in the ClassTests object *); end EndTest; op LoadTime is inputs: tm:Time, ttm:TotalTime; outputs: tm':Time; post: tm'.hours= tm.hours+ttm.hours and tm'.minutes=tm.minutes+ttm.minutes; description: (* The Timer will display adjusted time *); end LoadTime; op AddOneMin is inputs: tm:Time; outputs: tm':Time; post: tm'.minutes=tm.minutes+1 ; description: (* The Timer will display adjusted time *); end AddOneMin; op AddFiveMin is inputs: tm:Time; outputs: tm':Time; post: tm'.minutes=tm.minutes+5; description: (* The Timer will display adjusted time *); end AddFiveMin; op AddTenMin is inputs: tm:Time; outputs: tm':Time; post: tm'.minutes=tm.minutes+10; description: (* The Timer will display adjusted time *); end AddTenMin; op LessOneMin is inputs: tm:Time; outputs: tm':Time; pre: (* tm is greater than one minute *) tm.minutes > 1 or tm.hours > 1; post: if(tm.minutes > 1) then (tm'.minutes=tm.minutes-1) else (tm'.hours = tm.hours-1) and (tm'.minutes = 59); description: (* The Timer will display adjusted time *); end LessOneMin; op LessFiveMin is inputs: tm:Time; outputs: tm':Time; pre: (* time is greater than 5 minutes *) tm.minutes > 5 or tm.hours > 1; post: tm'.minutes = tm.minutes -5; description: (* The Timer will display adjusted time *); end LessFiveMin; op LessTenMin is inputs: tm:Time; outputs: tm':Time; pre: (* time is greater than 10 minutes *) tm.minutes > 10 ; post: tm'.minutes=tm.minutes-10; description: (* The Timer will display adjusted time *); end LessTenMin; op FreezeTest is inputs: tv:TestView*; outputs: tv':TestView; post: (* testView status is frozen *) tv'.stat = "frozen"; description: (* The selected test will not be editable *); end FreezeTest; op UnFreezeTest is inputs: tv:TestView*; outputs: tv':TestView; pre: (* TestView status is frozen *) forall (tv:TestView) tv.stat = "frozen" ; post: (* TestView status is unfrozen *) tv'.stat = "in progress" ; description: (* The selected test will be editable (unfrozen) *); end UnFreezeTest; op SetOpenNote is inputs: tv:TestView; outputs: tv':TestView; post: (* TestView is set for open note *) tv'.on = true; description: (* OpenNote allows students to access other programs while taking the test. *); end SetOpenNote; op ClosedNote is inputs: tv:TestView; outputs: tv':TestView; post: (* TestView is set for closed note *) tv'.on = false; description: (* ClosedNote prevents students from using other programs on the computer by locking the whole screen. *); end ClosedNote; op LaunchApp is inputs: tv:TestView, te:TakingEnvir; outputs: te':TakingEnvir; pre: (* TestView is set for open note *) tv.on = true; post: (* Application is launched *); description: (* App has been launched in the taking environment. *); end LaunchApp; end TestAdminister;