DisplayDivider Number of Employee

Displaydivider number of employee

This preview shows page 2 - 5 out of 8 pages.

.Write(Employee3.ToString()); ApplicationUtilities .DisplayDivider( " Number of Employee Object(s): " + EmpInfo .NumberEmployees + " " ); ApplicationUtilities .TerminateApplication(); } } } class EmpInfo { private string firstName; private string lastName; private char gender; private int dependents; private double annualSalary; private EmpBenefits benefit; private const int MIN_DEPENDENTS = 0; private const int MAX_DEPENDENTS = 10; private const double MIN_SALARY = 20000; private const double MAX_SALARY = 100000; private const string DEFAULT_NAME = "not given" ; private const char DEFAULT_GENDER = 'U' ; private static int numEmployees = 0; public static int NumberEmployees { get { return numEmployees; } } public EmpBenefits Benefit { get { return benefit; } set { if ( value != null ) benefit = value ; else benefit = new EmpBenefits (); } } public string FirstName {
Image of page 2
get { return firstName; } set { if ( value == null || value .Trim() == string .Empty) firstName = DEFAULT_NAME; else firstName = value ; } } public string LastName { get { return lastName; } set { if ( value == null || value .Trim() == string .Empty) lastName = DEFAULT_NAME; else lastName = value ; } } public char Gender { get { return gender; } set { if ( value == 'F' || value == 'f' || value == 'M' || value == 'm' ) gender = value ; else gender = DEFAULT_GENDER; } } public int Dependents { get { return dependents; } set { if ( value >= MIN_DEPENDENTS && value <= MAX_DEPENDENTS) dependents = value ; else if ( value < MIN_DEPENDENTS) dependents = MIN_DEPENDENTS; else if ( value > MAX_DEPENDENTS) dependents = MAX_DEPENDENTS;
Image of page 3
} } public double AnnualSalary { get { return annualSalary; } set { if ( value >= MIN_SALARY && value <= MAX_SALARY) annualSalary = value ; else if ( value < MIN_SALARY) annualSalary = MIN_SALARY; else if ( value > MAX_SALARY) annualSalary = MAX_SALARY; } } public EmpInfo() { firstName = DEFAULT_NAME; lastName = DEFAULT_NAME; gender = DEFAULT_GENDER; dependents = MIN_DEPENDENTS; annualSalary = MIN_SALARY; numEmployees = numEmployees + 1; benefit = new EmpBenefits (); } public EmpInfo( string first, string last, char gen, int dep, double salary, EmpBenefits benefit) { FirstName = first; LastName = last; Gender = gen; Dependents = dep; AnnualSalary = salary; numEmployees = numEmployees + 1; Benefit = benefit; } public double calculateWeeklyPay() { return annualSalary / 52; } public double calculateWeeklyPay( double modifiedSalary) { AnnualSalary = modifiedSalary; return AnnualSalary / 52; } public override
Image of page 4
Image of page 5

You've reached the end of your free preview.

Want to read all 8 pages?

  • Summer '19
  • Return statement, Void type, Health Insurance Company

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes