Question: Modify the payroll system of Figs. 10.410.9 to include private instance variable birth Date in class Employee. Use class Date of Fig. 8.7 to represent

Modify the payroll system of Figs. 10.4–10.9 to include private instance variable birth Date in class Employee. Use class Date of Fig. 8.7 to represent an employee’s birthday. Add get methods to class Date. Assume that payroll is processed once per month. Create an array of Employee variables to store references to the various employee objects. In a loop, calculate the payroll for each Employee (polymorphically), and add a $100.00 bonus to the person’s payroll amount if the current month is the one in which the Employee’s birthday occurs.

Fig. 10.4

I // Fig. 10.4: Employee.java 2 // Employee abstract superclass. 3 4 5 6 7 8 9 10 || 12 13 14 15 16 17 18 19

Fig. 10.9

I 2 3 5 6 7 8 9 10 || 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 20 1 2 3 4 35 36 31 38 39

Fig. 8.7I // Fig. 8.7: Date.java // Date class declaration. 2 3 4 5 6 7 8 9 10 || 12 13 14 15 16 17 18 19 20 NO 21 22

I // Fig. 10.4: Employee.java 2 // Employee abstract superclass. 3 4 5 6 7 8 9 10 || 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 W2NNN! 28 29 30 31 32 33 34 35 public abstract class Employee { private final String firstName; private final String lastName; private final String social SecurityNumber; } // constructor public Employee (String firstName, String lastName, String social SecurityNumber) { this.firstName = firstName; this.lastName = lastName; this.social SecurityNumber = social SecurityNumber; } // return first name public String getFirstName() {return firstName; } // return last name public String getLastName() {return lastName; } // return social security number public String getSocial SecurityNumber() {return social SecurityNumber;} // return String representation of Employee object @Override public String toString() { return String.format ("%s %s%nsocial security number: %s", getFirstName(), getLastName(), getSocial SecurityNumber()); } // abstract method must be overridden by concrete subclasses public abstract double earnings(); // no implementation here

Step by Step Solution

3.40 Rating (147 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To fulfill the request you need to modify the Employee class to include a new private instance variable birthDate of type Date Then you should create ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java How To Program Late Objects Questions!