Now, the people of Yakashaw are polite folk with real good upbringing. When a Yakashaw gentleman greets someone or is greeted, he not only says hello but he also bows. And when a Yakashaw lady greets someone or is greeted, she not only says hello but she also curtsies. Assuming, of course, that the person being greeted isn't at feud with the person doing the greeting. In that case, the greetee replies with a rude sniff and turns their back--about as rude as it gets in Yakashaw! (truly angry Yakashawians sometimes resort to yo-mama jokes, but this is rare). Thankfully, all Yakashawians are very polite, and they save the bloodletting until after the hoedown.
The class candidates that come first to come to mind are Person, Gentleman, and Lady. Looking through the description for other nouns, the candidates Yakashaw (the town), Hoedown, and Family seem like reasonable classes. Now let's refine this.
First, should Gentleman and Lady be subclasses of Person, or should there just be an attribute in Person to make the distinction? Well, for our purposes, the only difference is that they have different greeting behavior (bowing versus curtsying). Furthermore, a given instance will never change from being a Gentleman to a Lady nor vice versa. From these considerations, making them separate classes seems like a good way to go; we'll stick with that unless another consideration comes to mind.
Okay, well how should feud's be represented? We are going to need a way to ask questions like "Is Joe's family feuding with Sarah's family". So we need to represent which families are feuding with which... and that's about all our system needs to know about feuds. To simplify, we will even assume that each family is feuding with at most one other family (it's nice when "we" get to make up the requirements!)
So how should this be done? Maybe each Person should have a feudingWith attribute which says what family they are feuding with. Then, each Person also can have a family attribute which says what family they are in. To check whether two people are feuding, check one of their feudingWith attributes and see if it matches the other's family attribute.
That would work, but we can simplify it a little. Since every member of a given family should be feuding with the same other family, the feuding information isn't really specific to a Person, but to a Family. So let's put the feudingWith attribute in Family instances instead of Person instances; a person can still decide who they are at feud with by querying the family they are a member of. We have already decided to give a family attribute to Persons, so we're set.
The above covers pretty much all the basic functionality. We are left with the following classes:
"create families" macyntire _ Family new. macyntire name: 'Macyntire'. macynzie _ Family new. macynzie name: 'Macynzie'. jones _ Family new. jones name: 'Jones'. smith _ Family new. smith name: 'Smith'. elphen _ Family new name: 'Elphen'."set up feuds" macyntire feudingWith: macynzie. macynzie feudingWith: macyntire. smith feudingWith: jones. jones feudingWith: smith.
"create people" billyBob _ Gentleman new. billyBob name: 'Billy Bob'. billyBob family: macyntire. billyJo _ Lady new. billyJo name: 'Billy Jo'. billyJo family: macynzie. bubba _ Gentleman new. bubba name: 'Bubba'. bubba family: jones. jane _ Lady new. jane name: 'Jane'. jane family: smith. lauralanthala _ Lady new. lauralanthala name: 'Lauralanthala'. lauralanthala family: elphen.
"do some greetings" billyBob greet: billyJo. Transcript cr. billyJo greet: billyBob. Transcript cr. bubba greet: jane. Transcript cr. jane greet: bubba. Transcript cr. billyBob greet: bubba. Transcript cr. jane greet: billyJo. Transcript cr. bubba greet: lauralanthala. Transcript cr. lauralanthala greet: bubba. Transcript cr.
It should give the following output:
Billy Bob says, "Salutations, Billy Jo" Billy Bob bows. Billy Jo sniffs and turns away.
Billy Jo says, "Salutations, Billy Bob" Billy Jo curtsies. Billy Bob sniffs and turns away.
Bubba says, "Salutations, Jane" Bubba bows. Jane sniffs and turns away.
Jane says, "Salutations, Bubba" Jane curtsies. Bubba sniffs and turns away.
Billy Bob says, "Salutations, Bubba" Billy Bob bows. Bubba bows. Bubba says, "Greetings, Billy Bob. A most exquisite evening for a hoedown, is it not?"
Jane says, "Salutations, Billy Jo" Jane curtsies. Billy Jo says, "Hi, Jane!" Billy Jo curtsies.
Bubba says, "Salutations, Lauralanthala" Bubba bows. Lauralanthala says, "Hi, Bubba!" Lauralanthala curtsies.
Lauralanthala says, "Salutations, Bubba" Lauralanthala curtsies. Bubba bows. Bubba says, "Greetings, Lauralanthala. A most exquisite evening for a hoedown, is it not?"
Finishing the lab:
After you have completed debugging your code, fileout all the code using
the same steps as in Lab1.
You should turn in a fileOut of the code you wrote.
Mail the file to your TA any way that is convenient. Here is one way to do so:
1.Select Run from the Start menu and type in:
telnet lennon.cc
2.Login to lennon using your CoC login and password.
3.Change to your 2390 directory, eg cd ~/cs2390 (or wherever you put your code)
4.Type:
/usr/ucb/mail
-s "TI,Lab2,My SocialSecurity Number or Student Number" cs2390@prism.gatech.edu
< YourFile.st
(Replace My SocialSecurity Number or Student
Number with your student number, e.g.,
345544545).
Remember, this is just one way of turning in your code. You can
use whatever e-mail program you are comfortable with as long as you insert
the code as the body of the message (don't use attachments unless you are sending to your TA directly!) AND you follow the format for
the subject explained above:
"TI,Lab2,My SocialSecurity Number or Student Number
News Page | CS2390 Sp'98 Home Page | CS2390 CoWeb | STABLE | BOOST
Questions/comments/concerns to guzdial@cc.gatech.edu
Page last updated 4/17/98; 3:31:38 PM