Answer to Question #279732 in Java | JSP | JSF for meenu

Question #279732

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.



1
Expert's answer
2021-12-15T02:09:40-0500


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) {
        
    }
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog