San Jose State University | CS 151 - OO Design Section 5 | Fall 2016

Homework 2

This is a multi-part homework that extends over several weeks. Put all work into a directory hw2 of your Git project and push it each week.

Remember to run git commit at least once a day to get full points.

Part A

We want to implement a text messaging system that is somewhat similar to the voice mail system in the textbook. Here is a typical user interaction (inputs in bold):

Welcome to TextChat.
[L]ogin  [N]ew user  [Q]uit:
N
Select a user name:
fred
Select a password:
secret
User added.
Welcome to TextChat.
[L]ogin  [N]ew user  [Q]uit:
L
User name:
fred
Password:
secret
Welcome fred.
[S]end message  [R]ead messages  [L]ogout:
S
To:
mary
Message text, . to end:
Hi Mary, what's up?
Etc. Etc.
.
Message sent.
[S]end message  [R]ead messages  [L]ogout:
R
From: mary
Hi Fred, what a surprise.
Etc. Etc.
[K]eep  [E]rase
K
[N]ext  [D]one with messages
D
[S]end message  [R]ead messages  [L]ogout:
L
Welcome to TextChat.
[L]ogin  [N]ew user  [Q]uit:

Provide the following in the hw2 directory:

  1. We will have classes Message, Mailbox, MessageQueue, MailSystem like in the textbook. But does the Mailbox have a user name and password? Shouldn't that be a User? And there is no Telephone. Instead, use a class Console for interfacing with the user. Provide CRC cards for classes Mailbox, MailSystem, and Console. Write them out on real index cards and take a photo. Save it as crc.jpg.
  2. Provide a plain text file crc.txt in which you explain, for each collaborator, why it is a collaborator. What is an object of the class going to ask the collaborating object to do, and when?
  3. Draw a UML class diagram of the relationships between your classes. You can draw on paper and submit a photo or use a UML program or web site of your choice and turn in an image file (not the data file). Save it as uml.png
  4. Provide a plain text file uml.txt in which you explain, for each association and dependency, why an object of one class has, or uses, an object of the other.

Part B