CS 1101 - C-term 10

Homework 11 - Modelling a Discussion Board

Due: Tuesday, March 2 at 5pm


Assignment Goals

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 HW10 to your HW11 file. The TAs will run your solutions to HW11 on this set of test cases:
(add-user "Glynis" "ghamel")
(add-user "Kathi" "kfisler")
(add-user "Fan" "wuf")
(add-user "Bogomil" "bogi")
(add-course "CS1101" "ghamel")
(add-course "CS1102" "kfisler")
(add-to-course "bogi" "CS1102" 'student)
(add-to-course "bogi" "CS1101" 'student)
(add-to-course "wuf" "CS1102" 'student)
(add-forum "CS1102" "bogi" "HW1")
(add-forum "CS1102" "kfisler" "HW1")
(post-message "CS1102" "HW1" "bogi" "Problem 1" "I can't do Problem 1")
(post-message "CS1102" "HW1" "bogi" "Problem 5" "I can't do Problem 5")
(post-message "CS1102" "HW1" "kfisler" "Hints for Problem 3" "Use the template")
(get-unread-messages "bogi" "CS1102" "HW1")
(get-unread-messages "wuf" "CS1102" "HW1")
(get-unread-messages "kfisler" "CS1102" "HW1")
  1. 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.

  2. 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.

  3. Write a function get-unread-messages that consumes a username, a course title and a forum title and produces a list of the messages in the named forum that the user with the given username has not yet read. This problem requires that you write a helper function that operates on a list of messages. Write the helper using accumulator-style programming.

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 DrScheme and the Design Recipe.

What to Turn In

Using web-based turnin, turn in a single file containing all code and documentation for this assignment. Follow the naming conventions when naming your file. Make sure both partners' names and wpi login names are listed in a comment at the top of the file.