CJCoding With Joseph

Program to an Interface

A method that accepts an interface type works with any class that implements it. The IGreeting interface declares string Message(). Formal and Casual already implement it. In Welcomer, finish Welcome(IGreeting g) so it returns the greeting's Message() followed by , guest. Do NOT write a Main method.

For a Formal greeting the program prints:
Good day, guest
For a Casual greeting it prints:
Hey, guest

Expected Output:

Good day, guest
Topics:
Polymorphism
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.