Object Inheritance Lab Part Two (CodeGrade)

Close

Learning Goals


Key Vocab


Instructions

In this lab, you'll be coding a Student class, which will be the superclass, and a ChattyStudent class, which will inherit from Student.

ChattyStudent is a student, so they should have all of the behaviors and characteristics of a student. The difference is that ChattyStudent is very chatty. So, they will elaborate on any phrases that are inherited from Student.

Run the test suite to get started. This is a test-driven lab.

  1. Write a method in the Student class, hello(), that print() s out the phrase:

"Hey there! I'm so excited to learn stuff."

  1. Write a method in the Student class, raise_hand(), that print() s out the phrase:

"Pick me!"

  1. Write a method in the ChattyStudent class, hello(), that uses super() to inherit the behavior of the hello() method from the parent class. Then, augment that method to also print() out the very chatty phrase:

"How are you doing today? I'm okay, but I'm kind of tired. Did you watch The Walking Dead last night? You didn't?! Oh man, it was so crazy! What, you don't want any spoilers? Okay well let me just tell you who died..."

  1. Write a method in the ChattyStudent class, raise_hand(), that uses super() ten times so that the method will print() out "Pick me!" ten times. It is possible to call super() multiple times in a method.

Resources