Kotlinlearncs.online LogoJava
Return to List

Solve: Person Whisperer

Created By: Geoffrey Challen
/ Version: 2021.2.0

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:

  • a Student you should return the result of calling hey()
  • a Staff you should return the result of calling help()
  • a Professor you should return the result of calling hello()
  • otherwise return null.

You will need to downcast the passed Person appropriately in order to access and call the methods as described above.

Related Lessons

Stuck? You may find these lessons helpful: