... social security number to superclass Employee’s constructor (line 12) to initialize Employee’s private instance variables. Method toString calls superclass method toString (line 62) to obtain the Employee-specific information (i.e., first name, last name and social security number).

Fig. 10.7

 1  // Fig. 10.7: CommissionEmployee.java 
 2  // CommissionEmployee class extends Employee. 
 3
 4  public class CommissionEmployee extends Employee { 
 5     private double grossSales; // gross weekly sales 
 6     private double commissionRate; // commission percentage 
 7
 8     // constructor 
 9     public CommissionEmployee(String firstName, String lastName, 
10        String socialSecurityNumber, double grossSales, 
11        double commissionRate) { 
12        super(firstName, lastName, socialSecurityNumber); ...

Get Java How to Program, Early Objects, 11th 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.