University of Toronto - Fall 2000
Department of Computer Science

Assignment 4 Announcements

Sunday 15, October: toString and equals
Question:
My instructor told us every class we make should define toString and equals, but this handout says not to add any methods not specified. What should I do?
Answer:
In this case it's ok to have these methods, but they are not required.

Sunday 15, October: tenants per home, homes per tenant

Question:
Can a home have more than one tenant? Can a tenant have more than one home?
Answer:

It depends on whether you mean at a particular time, or over time. If you study the handout carefully the answers are there.

A general principle: you aren't responsible for forcing other code to use your classes correctly (though your comments and prototypes should have enough information so they can be used correctly). For example, certain methods in Tenant would only be called after setHome is called.


Sunday 15, October: One

Question:
When the handout says "one can" do something with a method, who does "one" refer to?
Answer:
It refers to the programmer writing a statement that calls the method. In particular it doesn't mean a user of the program, so there's no input nor output. Instead, information is passed to some methods, and returned from some.

Sunday 15, October: Classes vs. objects

Question:
What do "a MyClass" and "the MyClass" mean?
Answer:
They refer to instances of MyClass, as opposed to the class MyClass. Moreover, "MyClass" is meant to suggest the code, while "MyClass" suggests the concept (you're browser might not show you a visible difference between "MyClass" and "MyClass").

Sunday 15, October: getAddress methods

Question:
How many getAddress methods are there?
Answer:
Two. One for a home's address, and one for a tenant's (which is of course related to some home's address).

Sunday 15, October: Return values and arguments

Question:
What types should I use for the return value and arguments of a method?
Answer:

Sunday 15, October: Form of status string

Question:
Should there be a period at the end of each line, even if the address already ends with a period? And are there any blank lines involved?
Answer:
The status is two lines (no blank lines) and they both end with periods. Don't remove any periods from the end of the address. E.g. if the address is "100 St. George St." the first line of the status is "Lives at: 100 St. George St..".

Tuesday 10, October: A single String with two lines

Question:
Is it possible to return two lines of text in one String?
Answer:
Yes. There is a character that represents moving to a new line. As a String it's indicated by "\n". To see this effect, try printing the following String: "Give me a\nbreak!"

Tuesday 10, October: Positive or negative appetite

Question:
Will the appetite be positive or (exclusive or!) negative.
Answer:
If someone asked you (and you didn't know why) the amount of gruel you eat per meal (this is the phrasing used in the handout), what would you say?

Tuesday 10, October: main

Question:
Do I have to make a main method?
Answer:
Yes if you want to test your code (and why wouldn't you?), but it shouldn't be in the files you submit. See a similar announcement for assignment 3.