Question: In Java Create a class SchoolKid that is the base class for children at a school. It have attributes for the childs name and age,

In Java

Create a class SchoolKid that is the base class for children at a school. It have attributes for the childs name and age, the name of the childs teacher and a greeting. Create a constructor for SchoolKid class. It have appropriate accessor and mutator methods for each of the attributes. It has three methods changeAge(), changeTeacher() and changeGreeting() which modify the age, teacher name and greeting value. Test your program with name: Bob, age: 5, teacher name: Mrs. Jones and greeting: hi. Change age, teacher name and greeting using change methods. Derive a class ExaggeratingKid from SchoolKid. The new class should override the accessor method for the age, reporting the actual age plus 2. It also should override the accessor for greeting, returning the childs greeting concatenated with the words I am the best. Test your program with name: Bob, age: 5, teacher name: Mrs. Jones and greeting: hi. Change age, teacher name and greeting using change methods.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!