Contents
Next:
Input and Output
Up:
Simple Data Structures
Previous:
Defstruct
Exercises.
- 1.
- Design a simple data program that allows the user to enter and retrieve personnel data. Your program should store first and last names, addresses, age, marital status, and names of children. You may use any of the techniques introduced in this chapter, but your solution should not place any arbitrary limits, such as a limit on the number of children that can be associated with a person's record. Your program should allow the user to retrieve information about the person or persons whose records match a given key, for example to give the ages of everyone with the last name ``Smith.''
- 2.
- Write a function, num-kids, which uses the data stored by your program for the previous problem to answer the question how many children an individual has.
- 3.
- Write functions, num-boys and num-girls that answer how many of an individual's children are boys and how many are girls, using only the information mentioned in problem 1. In other words, your functions should use the children's names to determine their sex. You must at a minimum decide how to handle storage of a list correlating names and sexes, what to do if names not in your list are encountered, and how to handle names such as ``Francis'' that may be given to either sex.
© Colin Allen & Maneesh Dhagat
November 1999