This assignment is due by 5:30 p.m. on Tuesday, 6 November, . See the assignment turn-in page (last modified on 14 January 2006) for instructions on turning in your assignment.
You have been hired by a company that arranges dinner parties, weddings and
other similar functions. Your job is to write a program to generate seating
arrangements that are consistent with the company's approach to seating:
- A table seats nine people.
- Each person at a table has two neighbors: one to the left and the
other to the right.
- Two people can be neighbers if
- Both people have at least one common interest, and
- Each person is familar with the other person's family.
Write a program to generate an acceptable seating arrangement for a group of
people to be seated at a table.
Your program should read input from std-in. Each line of input read
should either be a blank line, which should be ignored, or a line describing a
person sitting at the table. A line describing a person has the form
first-name last-name interest... , last-name...
where
- first-name last-name is the person's name.
- interest... a list of between one and five interests, such as
chess or Balzac.
- last-name... is a list of one or more famlies with which this
person is familar.
First names, last names and interests are all one word; a comma separates
interests from familiar famlies.
If your program reads a non-blank line not in the expected format, or it
doesn't read nine people, it should print an informative error message to
std-err and exit with no further processing.
If your program can find a suitable seating arrangement, it should print it to
std-out, one person per line with the format
first-name last-name
If no seating arrangement exists, your program should output nothing.
You can use the program people
in the assignment directory
/export/home/class/cs-306/pa3
to generate a guest list, which is written to std-out.
This page last modified on 31 October 2007.
|
|