Activity 3.4 - Putting it all together
Topic
In this activity you will practise what you have learnt by writing a complete
class Member.
Materials
In addition to the Solution document, the project for this activity contains
two classes:
- Member, a class so far empty, but for comments!
- MemberTest, which will test your class when you have written it.
Task
Instances of Member represent members of a local conservation group.
Requirements:
- Member is to have three instance variables, representing a name, email
address and home address. You will need to define suitable instance variables
to represent these, and write a getter and a setter method for each attribute.
- The class should have a single three-argument constructor that allows
Member objects to be created with a given name, email address and home address
(in that order).
- The class should be equipped with an appropriate toString() method,
which returns a string describing a Member object's contents in a readable
form.
- The class should have an equals(Object o) method that returns true if the
object on which the method is invoked has identically valued instance
variables to the object referenced by the argument, and false otherwise.
Instructions
Write the code for the class Member to comply with requirements above and run
the project to test what you have done.