Create an EMPLOYEE class having First Name, Last Name, socialSecurityNumber(SSN). Class SalariedEmployee extends class Employee having weeklySalary as a member. An overloaded method CalculateEarnings to calculate a SalariedEmployee’s earnings. Class HourlyEmployee also extends Employee and have hourlyWage and hoursWorked as data members with overloaded method CalculateEarnings. Class CommissionEmployee having commissionRate and grossSales as data members extends class Employee with overloaded method CalculateEarnings. In main make ArrayList of Employees to display:
1)Employee with highest Earning.2)Employee with Lowest Earning.3)Average Earnings of all employees.4)Earning of employees on odd positions.5)Display Earning according to alphabetical order.
package employeetest;
class EMPLOYEE{
private String FirstName, LastName, SSN;
}
class SalariedEmployee extends EMPLOYEE{
private double weeklySalary;
double CalculateEarnings (){
return weeklySalary * 30;
}
}
class HourlyEmployee extends EMPLOYEE{
private double hourlyWage, hoursWorked;
double CalculateEarnings (){
return hourlyWage * hoursWorked;
}
}
class CommissionEmployee extends EMPLOYEE{
private double commissionRate , grossSales;
double CalculateEarnings (){
return commissionRate * grossSales;
}
}
public class EMPLOYEETEST {
public static void main(String[] args) {
}
}
Comments
Leave a comment