CS 1101 (A05) Homework 6: Discussion Boards

Due: October 4 (Tuesday) at 11:59pm

Assignment Goals


You must be in Advanced Student Language Level for this homework. Go to Choose Language under the Language menu to change your language level.


Developing a Discussion Board, Part 1

Across homeworks 6 and 7 you will develop a simple version of a discussion board. In a discussion board like you've been using on myWPI, each class has a collection of forums (for us, announcements, homework questions, etc) and each forum has a bunch of posted messages. When you log into myWPI, messages are marked according to whether you (personally) have read them or not. (To keep this assignment simpler, we will ignore the grouping--called threading--of messages with the same topic). In addition, certain operations (creating new forums) are restricted to users of a certain kind (staff versus students). Finally, access to course areas is updated automatically from the registrar's information about who is in each course.

This description suggests that a discussion board system relies on two major pieces of information: info on registered users of the system and discussion board contents for each course. More specifically:

As you work on the following problems, keep an eye out for helper functions that could be reused across multiple problems. Reading all of the problems first may help you find common helpers.

Also see the note about testing in question 8. You do not need to test cases that will produce errors.

  1. Write the data definitions for lists of registered users and discussion board contents (list of courses) as described above.

  2. Define two variables, one for the list of registered users and one for the list of courses. Give the registered users list an initial value of at least 4 users, none of whom are participating in any course. Initialize the discussion board contents with no courses.

  3. Write a function add-user that consumes a user's real name and username and produces void. Its effect is to add a new user to the list of registered users. The new user should not contain any courses. You may assume that the given username is not already in the list of registered users. The new user may go anywhere in the list.

  4. Write a function add-course that consumes a course title and professor's username and produces either void or raises an error. Its effect is to create a new course in the discussion board contents with the professor as a faculty member (and no forums) if the professor is in the list of registered users. If the professor is not a registered user, the function raises an error and leaves the discussion board contents unchanged. The new course should be listed in the courses that the professor participates in (inside the professor's registered-user structure).

  5. Write a function cancel-course that consumes a course title and produces void. Its effect is to remove the course with the given title from the discussion board contents and to remove the course title from the list of courses participated in by any user.

  6. Write a function add-to-course that consumes a username, a course title and the user's role in the course and produces void. The effect of the function is to add the course title to the list of courses in which the user is participating and to add the given username as a member in the named course (with the given role).

  7. Write a function get-user-courses that consumes a username and produces a list of courses (not course titles!) in which the user is participating.

  8. Produce a sequence of test cases for the interactions between these functions. You do not need to provide tests for the individual functions (but we strongly suggest that you test the individual functions as you write them anyway).

Turn in these problems for homework 6 but keep a copy of the file handy as you will continue adding functions to this example in homework 7.


What to Turn In

Turn in a single file hwk6.ss (or hwk6.scm) containing all code and documentation for this assignment. Make sure that all students' names are in a comment at the top of the file.


Guidelines


Back to the Assignments page