G.10.5. Indirect Concrete Subclass BasePlusCommissionEmployee
Class BasePlusCommissionEmployee
(Fig. G.20) extends class CommissionEmployee
(line 4) and therefore is an indirect subclass of class Employee
. Class BasePlusCommissionEmployee
has a constructor (lines 9–14) that takes as arguments a first name, a last name, a social security number, a sales amount, a commission rate and a base salary. It then passes all of these except the base salary to the CommissionEmployee
constructor (line 12) to initialize the inherited members. BasePlusCommissionEmployee
also contains a set method (lines 17–24) to assign a new value to instance variable baseSalary
and a get method (lines 27–30) to return baseSalary
’s value. Method earnings
(lines 33–37) calculates ...
Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.