object HandinDirectory is

    components: ItemName and StudentName and Deadline and File*;
    description: (*
        A HandinDirectory is a directory for an Item. The ItemName component
        is the name of the Item. The StudentName component is the name of the
        Student. The Deadline component is the due date/time of the Item. The
        Files component is composed of the files that a Student has handed in.
    *);
end HandinDirectory;

object ItemName is string;
object Deadline is integer;

operation HandinItem is
    inputs: s:Server, dir:HandinDirectory, File*;
    outputs: s':Database;
    precondition: (* User is logged in and Deadline has not passed. *);
    postcondition: (* The Files are now in the professor's handin directory.
                    *);
    description: (*
        HandinItem is a way for Students to submit Item files to the
        Professor.
    *);
end HandinItem;

object Server is users:Users and db:Database
    description: (*
        A server has a list of authentic users and a database.
    *);
end Server;

object Users is UserRecord*;
object UserRecord is uid:UserID and passwd:Password;
object UserID is string;
object Password is string;

object Database is
    components: UserRecord*;
    description: (*
        A Database is the repository of registered user information. It is
        a collection of UserRecords.
    *);
end Database;

operation Login
    in: s:Server, uid:UserID, passwd:Password;
    out: db:Database;
    pre: exists (u in s.users) (u.uid = uid) and (u.passwd = passwd);
    post: db = s.db;
    description: (*
        Login to the server to access its database. If the user name and
        password exist on the server's user list, then return the database,
        otherwise nil.
    *);
end Login;