Design a "quick chat" system. This universe program allows people to
"chat" with each other, i.e., to exchange short "one line" messages. A
participant uses a chat space, which is a window divided into two spaces:
the top half for listing the messages received and the bottom half for
listing the messages sent plus the one message the participant is
currently entering. The two halves display the messages in historical
order, with the most recent message received/sent at the bottom. When
either half is full of messages, the least recent line of the respective
part is dropped.
The snap shot above shows the chat space for a participant who has
received one message from someone called "carl" (see red name in top half)
and who is about to send said "carl" a reply.
Each message is at most one line of text, which is the width of the
window. That is, a message is sent when the line is one character too wide
for the screen or when the user hits "\r" (return).
A line in the chat space consists of two pieces: an address and a
message, where the former is separated from the latter with a ":". The
user sends a message by typing the name of a participant, followed by ":"
and the text of the message. Once the ":" is entered, it becomes
impossible to change the recipient. The rest of the line is the message.
A message whose recipient is "*" is broadcast to every current participant.
Otherwise a message is sent to the designated recipient, if the string is
the valid name of a current participant; all other messages disappear in
the big empty void.
Each received message is displayed like those that are sent, with an sender
followed by ":" and the text of the message. If the message went to all
participants, the sender's name is followed by an asterisk "*" before the
As you work on this project, you will encounter questions for which this
problem statement doesn't provide enough information to make decisions. You
must make the decisions on your own, following this procedure:
- do not opt for answers that render the project trivial
- document all non-trivial answers and the answer you chose
- provide a reason for your choice