C Create an Employee class with six fields first name last n
C#
Create an “Employee” class with six fields: first name, last name, workID, yearStartedWked, initSalary, and curSalary. It includes constructor(s) and properties to initialize values for all fields (curSalary is read-only). It also includes a calcCurSalary function that assigns the curSalary equal to initSalary.
Solution
Employee.cs
public class Employee
{
private string firstName;
private string lastName;
private int workID;
private int yearStartedWked;
private double initSalary;
private readonly double curSalary;
public Employee(string f, string l, int w, int y, double i, double c){
firstName = f;
lastName = l;
workID = w;
yearStartedWked = y;
initSalary = i;
curSalary = c;
}
public void calcCurSalary(){
initSalary = curSalary;
}
}
