(**** * The Gradebook object is a collection of Class objects. It takes care of the managin of Class objects. The Gradebook object also manages a list of Student and GradedItems that are visible to the user. *) module gradebook; from class import Class; from student import Student; from item import Item; export all; object UserWorkspace is components: Clipboard, Context, PreviousState; end UserWorkspace; object PreviousState is Class*; object Number is components: number:integer; end Number; object confirmationOutput is string; object login is string; object owner is string; object password is string; object Server is components: ClassDB*, File*, userDB; end Server; object userDB is components: login*, password*; end userDB; object ClassDB components: course*, section*, admin*; end ClassDB; object admin is string; object course is string; object section is integer; object newClassName is string; object Clipboard is string; object Context is components: contextStu:Student, contextIt:Item; end Context; object File is components: timestamp:Timestamp, filedata:FileData; end File; object FileData is Gradebook; object Timestamp is components: Date, Time; end Timestamp; object Date is components: Month, Day, Year; end Data; object Month is integer; object Day is integer; object Year is integer; object Time is components: Hour, Minute, Second; end Time; object Hour is integer; object Minute is integer; object Second is integer; object Gradebook is components: classes:Class*, currentclass:Class; end Gradebook; operation connect is inputs: login, password, Server; outputs: Gradebook*; description: (* Connects to the given server and returns a collection of gradebooks. *); end connect; operation disconnect is inputs: login, Server; outputs: Server; description: (* Disconnect from the given server. *); end disconnect; operation newClass is inputs: newClassName; outputs: Gradebook; precondition: (* newClassName cannot match with an existing file *); postcondition: (* a new Gradebook named by newClassName is outputted *); description: (* Creates a new blank grade book locally with a specified name. *); end newClass; operation save is inputs: Gradebook; outputs: File; precondition: (* There must be an active grade book *); postcondition: (* The current active grade book is saved to local disk or remote server *); description: (* Saves the current active grade book to local disk or remote server. *); end save; operation open is inputs: File; outputs: Gradebook; precondition: (* The gradebookPath must be a path to an existing gradebook *); postcondition: (* The grade book specified by gradebookPath is outputted *); description: (* Opens a grade book given a grade book path name. *); end open; operation close is inputs: Gradebook; outputs: Gradebook; precondition: (* There must be an active grade book *); postcondition: (* The currently active grade book is closed *); description: (* Closes the currently active grade book *); end close; operation exit is inputs: Gradebook; outputs: Gradebook; precondition: (* The grade book application must be open *); postcondition: (* The grade book prompts to save any grade book that is open and has a newer timestamp on it than its corresponding grade book file, then the grade book app will close *); description: (* Closes the grade book application and prompts to save any currently open grade books if their timestamps are newer than that of their corresponding grade book files. *); end exit; operation scaleGrade is inputs: Class; outputs: Class; precondition: (* Class must exist *); postcondition: (* The grade scale is modified *); description: (* modifies the grade scale for a class *); end; operation predictGrade is inputs: Student*; outputs: Item*; precondition: (* The class must be populated with valid students and graded items. *); postcondition: (* The predicted grade or the points required is displayed *); description:(* predicts the grade to be received given past graded items and expected points to be received for future items, or calculates the score needed on future graded items needed to receive a desired grade. *); description: (* The gradebook contains 0 or more classes. *); end predictGrade; operation cut is inputs: string; outputs: Clipboard; description: (* Adds currently highlighted text to the clipboard and removes the text from where it was cut. *); end cut; operation copy is inputs: string; outputs: Clipboard; description: (* Adds currently highlighted text to the clipboard. *); end copy; operation paste is inputs: Clipboard; outputs: string; description: (* Removes the puts the string currently held in the Clipboard and puts it at wherever the cursor is. *); end paste; operation find is inputs: Context, string; outputs: Context; description: (* Searches through the current context and finds the string. *); end find; operation replace is inputs: Context, string*; outputs: Context; description: (* Searches through the current context and finds one string and prompts to replace it with another string. *); end replace; operation enterScore is inputs: grid:Context, score:integer, class:Class; outputs: Context, integer; precondition: (grid.contextStu in class.studs); postcondition: ( forall (i:integer | (i >= 0) and (i < #class.studs)) (class.studs[i].grades = grid.contextStu.grades) iff ( class.studs[i] = grid.contextStu) ); end enterScore; end gradebook;