Define a public class Whisperer
that provides a single class method named whisper
.
whisper
should accept a single Person
instance and return a String
.
If the person is:
Student
you should return the result of calling hey()
Staff
you should return the result of calling help()
Professor
you should return the result of calling hello()
null
.You will need to downcast the passed Person
appropriately in order to access and call the methods as described
above.
You're challenge is to write tests for this problem described above.
Stuck? You may find these lessons helpful: