CS 1101 - C-term 10

Homework 9 - Descendant (variable-width) Trees

Due: Friday, February 19 at 5pm


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

Assignment Goals

To make sure you can

The Assignment

Start with the soccer league data definitions and templates you designed for Homework 8. Or, if you prefer, use the published answers to Homework 8 as your starting point. (Answers will be published after the late deadline for HW8, 5pm on Wednesday, Feb 17.)

Writing Scheme Programs over Trees

  1. Write a function number-of-players that consumes a person (representing the root of a soccer league hierarchy) and produces the total number of players on all teams in the league.

  2. Write a function names-of-coaches that consumes a person and produces a list of the names of all coaches in the person's hierarchy.

  3. Write a function change-phone that consumes a person (at the top of a hierarchy), a person's name, and a phone number. The function produces a person the same as the original, except that the phone number of the person with the given name has been changed to the given phone number. You may assume that the named person exists in the hierarchy, and that names are unique.


What to Turn In

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