175,448 views
6 votes
6 votes
Assume you have created an inheritance hierarchy with the following classes:

Class: Organization
Methods: getName(), getNumEmployees(), getTaxLiability()
Class: Nonprofit extends Organization
Methods: getAnnualContribution(), getTaxLiability()
Class: Commercial extends Organization
Methods: getTaxLiability()
In your implementation class, assume you create the following line of code.

Organization o = new Nonprofit();

Using this line of code, write additional code that will call the getAnnualContribution() method

User Nathan Merrill
by
2.8k points

1 Answer

28 votes
28 votes

Answer:

Creating an object of Class Organization Organization o = new Nonprofit

Step-by-step explanation:

Organization Methods: getName(), getNumEmployees(), getTaxLiability(). Class: Nonprofit extends Organization Methods: getAnnualContribution(), getTaxLiability(). Class: Commercial extends Organization Methods: getTaxLiability().

User Xeperis
by
2.6k points