CS 1101 - C-term 08

Homework 12 - Modelling a Discussion Board

Due: Tuesday, February 26 at 11:59pm


Assignment Goals

To make sure you can create linked data structures and write programs using assignment.

Remember to follow the Expectations on Homework when preparing your solutions.


The Assignment

Developing a Discussion Board, Part 2

You should start by copying your data definitions and functions from HW11 to your HW12 file.
  1. 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).

  2. Write a function find-course that consumes a course title and produces a course (structure). The produced course should be the one from the discussion board contents with the given title. Use this function as a helper in the remaining problems.

  3. Write a function add-forum that consumes a course title, a username, and a forum title and produces void. The effect of this function is to add a new forum to the course with the given title if the given username is a faculty member for the course. If the given username is a student or not a member of the course, then the forum stays unchanged. You may assume that the forum title has not been used on another forum in the same course.

  4. Write a function post-message that consumes a course title, a forum title, a username, message title, and message contents and produces void or "unknown forum". The effect of this function is to add a new message with the given input data to the discussion board, marked as read only by the person who posted the message. The function should produce "unknown forum" if the forum is not in the named course. Only registered users of a course may post a message to a forum.
  5. 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).

There's obviously a lot more that can be done with this Discussion Board system. I hope these problems have given you a sense of the complexity of the problems you can now solve using Scheme.

What to Turn In

Using web-based turnin, turn in a single file hw12.scm containing all code and documentation for this assignment. Please make sure both partners' names and wpi login names are listed in a comment at the top of the file.