Develop a Python program made of three classes: Person, Student and Teacher. The Student and Teacher classes inherit from the base class Person.
Instructions
- The
Person class has two methods: greet(), which displays Hello!, and set_age(age), which sets the age of the person. - The
Student class has the method study(), which displays I'm studying, and the method show_age(), which displays My age is x years. - The
Teacher class has the method explain(), which displays I'm explaining. - Create a test class called
StudentTeacherTest with a main method that:
- Creates a Person and greets. - Creates a Student, sets an age, greets, shows the age and studies. - Creates a Teacher, sets an age, greets and explains.
Input and output format. Read, with no prompts, the age of the student and then the age of the teacher (one per line). The program prints, one per line: Hello! (person), Hello!, My age is X years, I'm studying (student), Hello!, I'm explaining (teacher).