Answer to Question #231695 in Java | JSP | JSF for Chadwin Fritz

Question #231695

rules that govern employee behaviour are as follows: Most employees work 37.5 hours per week. employees earn R50 000 per year. Managers earn R20 000 extra per year. employees get 15 workdays leaves a year. Managers get an extra 3 days leave per year. Secretaries must work 40 per week. Name is the only attribute you need. Required: 1. Code the classes Employee, Manager and Secretary. 2. Code an application with the main method. In this class you must code an array of type Employee with a maximum size of 20. a. Add a minimum of 10 objects to the array. You may hard-code these object values. The objects must be a mixture of Employee, Manager and Secretary. b. Display all the objects on the screen. c. Calculate, and then display, the average salary of all employees. Extra Calculate and display the cost of the leave for each employee.


1
Expert's answer
2021-09-01T23:58:20-0400
  
class EmployeeDetails {    
int empid, salary;  
String name;  
public int getEmpid() {  
    return empid;  
}  
public void setEmpid(int empid) {  
    this.empid = empid;  
}  
public int getSalary() {  
    return salary;  
}  
public void setSalary(int salary) {  
    this.salary = salary;  
}  
public String getName() {  
    return name;  
}  
public void setName(String name) {  
    this.name = name;  
}  


}  


@Override  
public String toString() {  
    return "Employee [emp_id = " + empid + ", salary = " + salary + ", name = "  + "]";  
    }  
      
}   
public class Employee{    
    public static void main(String args[]) {  
        EmployeeDetails emp = new EmployeeDetails();  
        emp.setEmp_id(123);  
        emp.setName("Juma");  
        emp.setSalary(20000);   
        System.out.println(emp);  
            
        
    }  
}  

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
APPROVED BY CLIENTS