in this example we will use most of OOP features in c#, like:
- methods
- class and object
- instance and constructor
- access modifiers ( public, private, default, protected).
- encapsulation (set and get)
- inheritence
- method overriding
- arrays of objects
- polymorphism
----------------------------------------------------
develop a simple HR information system to manage employees salaries,
any employee has basic properties like: id, name, born date, gender, basic salary, accomodation allowance, food allowance
there are 2 types of employees:
this employee gets his salary upon hourly basis, the normal work hours in the month are 174 hours, any extra work hours will be added to basic salary.
this employee gets his salary without calculation of worked hours, and takes a monthly bonus added to his basice salary, the bonus is calculated based on employee classification ( class 1 for managers: bonus is 20% out of basic salary, class 2 for moderate managers: bonus is 15% out of basic salary, class 3 for operators: bonus is 10% out of basic salary)
----------------------------------
also build a test Class and create an array of 5 employees, read employees data from keyboard and then print total salary of each employee.
Employee class:
HourlyEmployee class:
BonusEmployee Class:
Program Class for testing:
need an explanation for this answer? contact us directly to get an explanation for this answer