Programming Assignment 3 - Seating Arrangements

Computer Algorithms II, Fall 2007


Due Date

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.

Background

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:

The Problem

Write a program to generate an acceptable seating arrangement for a group of people to be seated at a table.

Input

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 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.

Output

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.

Testing

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.