Further Examples

Money

What is money?

What is the essential information a program needs to know about money? How can these be represented as fields in a Money class?

Is this the only way to represent Money?

What should the constructor for Money look like?

What should the toString() method for Money look like?

Do you need any getter or setter methods? (Can money change its state or should it be immutable?)

What do you want to do with money? What methods should you write?

Angles

Complex Numbers

What is a complex number?

What are the essential parts of a complex number? How can these be represented as fields in a ComplexNumber class?

Is this the only way to represent a complex number?

What should the constructor for a ComplexNumber look like?

What should the toString() method for a ComplexNumber look like?

Do you need any get() or set() methods? (Can a complex number change its state or should it be immutable?)

What do you want to do with a complex number? What methods should you write?

Course Registration


Previous | Next | Top
Last Modified January 9, 1998
Copyright 1997-1998 Elliotte Rusty Harold
elharo@metalab.unc.edu