// Derived class from Person, // base class for Executive. public class Executive extends Employee { private double bonus; public Executive(String theName, char theGender, int theAge, int theId, double theSalary, double theBonus) { // Call base class constructor. super(theName, theGender, theAge, theId, theSalary); // Set the Employee instance variables. bonus = theBonus; } public double getCompensation( ) { return salary + bonus; } public String toString( ) { return String.format("%s %.2f", super.toString( ), bonus); } public static void main(String[ ] args) { Employee p = new Executive("Susan", 'F', 45, 77777, 250000.0, 150000.0); System.out.println("Id for p is " + p.getId( )); System.out.println("Compensation for p is " + p.getCompensation( )); System.out.println("Output of toString for p is "); System.out.println(p); } }