CS 1101 - A-term 10

Homework 9 - Trees

Due: Friday, October 1 at 5pm


Assignment Goals

To make sure you can

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


The Assignment

Start with the file system data definitions and templates you designed for Homework 8. Or, if you prefer, use the published answers to Homework 8 as your starting point.

Writing Programs over Trees

  1. Write a function count-directories that consumes a file system and produces the total number of directory-type files in the file system.

  2. Write a function list-write-protected-files that consumes a file system and produces a list of the names of all the files in the file system that are write-protected.

  3. Write a function exceeds-limit? that consumes the name of a file, a file system, and a number and produces true if the size of the named file exceeds the given limit. You may assume that the named file exists in the file system.

  4. Write a function add-file-to-folder that consumes a file, the name of an existing (directory) file, and a file system and produces a file system. In the returned file system, the existing directory file contains the new file. You may assume that the name provided as an input is the name of a directory file that exists in the file system. You may also assume that this name is unique in the file system.


What to Turn In

Here is the grade sheet for Homework 9.

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