Question: 9.14 please (USInS he first state- Method's Body Explain why you would use super in the body d Class's Body) In Figs. 9.10-9.11 methods earnings
(USInS he first state- Method's Body Explain why you would use super in the body d Class's Body) In Figs. 9.10-9.11 methods earnings and to subclass constructor Buy ment of a Explain Uising super in am Instance 9.12 of a subclass's instance method methods within the same class. Explain the benefits of call String each call var methods within the classes. 9.14 (Employee ing these get an inheritance hierarchy in which class Hierarchy) In this chapter, you studied usomissionEmployee inherited from class CommissionEmployee. However, not al BasePlusCommissi employes are ionEmployees. In this exercise, you ll create a more general Employee superclass he attributes and behaviors in class CommissionEmployee that are common to all En- for all Employees are firstName, lasthame, r, getFirstName, getLastName, getSocialSecurityNumber and a portion of are Commiss ionEmployees. In this exercise, you'll create a more ployees. The common attributes and behaviors socialSecurityNumber nchod ods and a totring. Create a new superclass Employee that contains these instance variables and meth constructor. Next, rewrite class Commi ss i onEmployee from Section 9.4.5 as a subclass of Em ployee. Class CommissionEmployee should contain only the instance variables and methods that ar no decdared in superclass Employee. Class CommissionEmployee's constructor should invoke class Em ployees constructor, and CommissionEmployee's toString method should invoke Employee's to- tring method. Once you've completed these modifications, run the CommissionEmployeeTest and PlusCommissionEmployeeTest apps using these new classes to ensure that the apps still display the ne rouls for a CommissionEmployee object and BasePlusCommissionEmployee object, respectively. Creaing a New Subclass of Employee) Other types of Employees might include Salaried- ses who get paid a fixed weekly salary, PieceWorkers who get paid by the number of pieces prod ueor HourlyEmployees who get paid an hourly wage with time-and-a-half-1.5 times the wage-for hours worked otar 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
