CJCoding With Joseph
15free / daySign inCreate account

Dog Says Woof

A Dog is an Animal, so it inherits speak, which prints <name> makes a sound. Override speak in Dog with a method of the same name that prints <name> says Woof. instead; the parent class stays as it is. Do NOT write a main block or any top-level test code; the tests construct the class. Input: one line, a name, which the tests read and use to construct an Animal and a Dog before calling speak on each, so the output shows the parent line first and then the dog line.

Expected Output:

Rex makes a sound.
Rex says Woof.

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
ClassesInheritance
📥 Auto-Input:
Rex\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.