: Java Class Inheritance with an abstract class Define a class Employee with the following fields: _name, _empId, _department, _position (_title), _yearlySalary, _fullTime (a boolean: true/false) , _month , _year (time of hire) Add constructor and properties Define an abstract method GetBiMonthlySalary() (if the employee is paid twice a month) Define an abstract method GetVacationTime() that returns the number of vacation time this employee would have based on time of hir
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
language: Java
Class Inheritance with an abstract class
Define a class Employee with the following fields: _name, _empId, _department, _position (_title), _yearlySalary, _fullTime (a boolean: true/false) , _month , _year (time of hire)
Add constructor and properties
Define an abstract method GetBiMonthlySalary() (if the employee is paid twice a month)
Define an abstract method GetVacationTime() that returns the number of vacation time this employee would have based on time of hire
Override the ToString() method to return a string that contains the information pertaining to an employee such as name, empId, department, and where full time or not.
Define a class HourlyEmployee that inherits from Employee.
This class should have 2 fields of its own: _hours (hours worked in half a month) and _wage (hourly wage)
Provide necessary constructor, properties and methods
Override the ToString() to also return the additional fields
Gets 3 days of vacation after first year if the employee works at least 40 hours a month.
Vacation time does not increase after that
Define a class SeasonalEmployee that also inherits from Employee
This is a temporary employee, who is paid on hourly basis. Make it part of the Employee class
family, by inheriting one of the above classes.
This class should have an additional field: _contractDuration (in month)
Provide necessary constructor, properties and methods
Gets no vacation time.
Also override the ToString() method
Define a class RegularEmployee (gets a yearly salary)
Provide necessary constructor, propereties and method
Rule for Vacation time: one week after first year for the next 5 years of work. Earn an extra day each year after that. After 20 years of work vacation time stays constant
In Form1:
Create a List of Employees
Define a method preloadEmployeeList with at least 2 employees of each type
Define a method displayEmployeeList (name, empid, bimonthsalary,vacation accrued) to a JTable
Define a method DisplayEmployeeList2. To display to a JTextArea the data returned by ToString() method.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps