Create a Java class Employee that will describe the characteristics of the employees of a company. This class should contain the name (first and last name), omang, address, etc of the employee, together with pay information. Given that this company has two different types of employees, those on a salary and those paid by the hour. Create two subclasses of Employee: SalariedEmployee and HourlyEmployee, with different methods for calculating monthly pay and for displaying an employee details. Both of these subclasses should inherit all of the common information and methods from Employee, but should override the methods used to calculate pay and to display employee details.
Possible specifications for Employee, SalariedEmployee and HourlyEmployee classes are given below:
Class ? Employee Instance Variables ? firstName, lastName, address, omang, pay Constructors ? Employee() // all Strings to null, pay=0? Employee(first, last, id) // Initializes with values, pay=0 Methods ? setName (first, last)? setOmag(id)? get FirstName()? get lastName()? getOmang()? toString()? calcPay (value)
you shoudl first make an Employee class or maybe an employee interface that just has methods with out a body, then make the two subclasses and just implement the methods for each diferent employee. Like,
class Employee { final static int HOURLY_PAY = 0; final static int YEARLY_PAY = 1;