Create a class: Employee. This class will have 2 String variable a) fName , b)lName
1 long variable a) _ID, 1 int variable workDays, 5 float variable a) BASIC, b) HRA, c) TA, d) PF, e) NET. All these variables are private. Also Getter and Setter method for _ID, fName, lName, BASIC.
Getter methods are used to retrieve values from these variables. These Getter methods are public. Setter methods are used to store values in these variables. These Setter methods are public. Also create a method calculateSalary(), that will calculate net salary for the employee based on given rules.
1. BASIC = BASIC * workdays
2. HRA = 40% of BASIC
3. TA = 10% of (BASIC + HRA)
4. PF = 12.5% OF (BASIC + HRA + TA)
5. NET = (BASIC + HRA + TA) - PF
Variables:-
private String fName, lName
private long _ID
private Int workdays
private float BASIC, HRA, TA, PF, NET
Methods:-
public void set_ID(long _ID)
public long get_ID()
public void setfName(String fName)
public String getfName()
public void setlName(String lName)
public String getlName()
public void setBASIC(float BASIC)
public float getfBASIC()
public void calculateSalary()
Save the File as “Employee.java”
Create class Company: this class will have the main method along with another method called void genID(), to generate employee ID. Hine:- use Random method of Math class to create employee ID.
From main method ask user to enter First name, Last name, Daily Wages and Number of Working Days. Store them in appropriate variables of Employee class using Setter methods. Then call genID() method of this class then calculateSalary() method of Employee class. Create 5 employee objects and store them in an array of Employee. Then print details list of all the employees.
求人工翻译,软件翻译脱离原来题意差太多了,没法看