Question: Modify the Person super class exercise to include an additional class called Adult. The Adult class will also extend the Person class. The Adult subclass

Modify the Person super class exercise to include an additional class called Adult. The Adult class will also extend the Person class.

The Adult subclass will require a variable workLocation of type String in addition to the age variable. Include the proper get and set methods.

Modify the Test class to include an array of type Person. Instantiate one adult and one child object, placing them in the array. Loop through the array and call the getAge() methods of each object. After looping, call the getSchool() method of the child object and the getWorkLocation() of the Adult. Finally call the speak() methods of each object, passing in a phrase for each.

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!