Remember to follow the Expectations on Homework when preparing your solutions.
In this assignment you will keep track of a master list of people in the job network. Each person in the network has a list of contacts who are other people in the network.
You do not have to write test cases for individual functions in this assignment. The last problem deals with testing.
create-person
that consumes a person's name,
company, and telephone number and returns a new person with the given information (and no contacts).
The new person should also be added to the job network. You may assume the named person does not already exist in the network. (Make sure your function creates only one person.)
list-names
that consumes nothing and
produces a list of the names of all people in the job network.
You may solve this problem one of two ways: either use accumulator-style programming, or use higher-order functions (i.e.map and/or filter).
add-contact
that consumes two persons.
The function puts the second person in the first person's contact list
(you may assume that the second person isn't already in the first person's
contact list).
Your function should return void.
Clarification: you may assume that the two persons are
in the network.
most-contacts
that consumes nothing and returns the person in the job network who has the most contacts in his/her contacts list
(resolve ties arbitrarily). Return "empty network" if the job network doesn't contain any persons.
You may use the DrRacket built-in function length that determines the length of a list. You should use accumulator-style programming. The accumulator
keeps track of the person found so far who has the most contacts.
change-phone
that consumes the name of a
person and a new telephone number and changes that person's telephone number to the new number. Of course, the change should also show up in all occurrences of the named person in any of the contact lists.
;; show the initial contents of job network "The job network is initially empty" network ;; populate the network with three people... (define Glynis (create-person "Glynis" "WPI" 5252)) (define Adam (create-person "Adam" "Cisco" 5544)) (define Jen (create-person "Jen" "Hood" 6924)) "Here's the network with Glynis, Adam, and Jen in it" network ;; put Adam in Glynis's contact list ;; (etc.)
Here is the grade sheet that the TAs will use when they grade Homework 7.
Using web-based turnin, turn in a single file containing all code and documentation for this assignment. Follow the naming conventions for file names. Please make sure both partners' names and wpi login names are listed in a comment at the top of the file.