Create a C# Application. Create a class called “Employee” which includes the fol
ID: 3783717 • Letter: C
Question
Create a C# Application. Create a class called “Employee” which includes the following private variables:
firstN
lastN
idNum
wage: holds how much the person makes per hour
weekHrsWkd: holds how many total hours the person worked each week
regHrsAmt: initialize to a fixed amount of 40 using constructor.
regPay
otPay
After going over the regular hours, the employee gets 1.5x the wage for each additional hour worked. Methods include:
constructor
properties
CalcPay(): Calculate the regular pay and overtime pay.
___________________________________________________________________________
Then create an “EmployeeDemo” class.
In the main function, the program should ask the user the number of employee in the company and create a 2-dimensional dynamic array (number of employee by 4 weeks). Then, the program should ask user to enter each employee’s information and the amount of hours they worked weekly.
The program shows a menu with employee name for user to choose which employee to display the following information:
How much the person totally made
How much of paycheck is regular pay
How much of paycheck is overtime pay
Explanation / Answer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EmployeeProgram
{
public class employee
{
private int employeeNumber;
private string name;
private string hiredate;
private int monthlySalary;
private string description;
private string department;
public employee(int employeeNumber, string name, string dateOfHire, int monthlySalary, string description, string department)
{
this.employeeNumber = 321;
this.name = "Alex";
this.hiredate = "01/02/15";
this.monthlySalary = 2500;
this.description = "Corporate grunt";
this.department = "Sales";
}
public int EmployeeNumber
{
get
{
return employeeNumber;
}
set
{
employeeNumber = value;
}
}
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
public string Hiredate
{
get
{
return hiredate;
}
set
{
hiredate = value;
}
}
public int MonthlySalary
{
get
{
return monthlySalary;
}
set
{
monthlySalary = value;
}
}
public string Department
{
get
{
return department;
}
set
{
department = value;
}
}
public string Description
{
get
{
return description;
}
set
{
description = value;
}
}
public override string ToString()
{
return "Employee ID: " + employeeNumber +
"Employee Name: " + name +
"Employee Hire Date: " + hiredate +
"Employee Monthly Salary: " + monthlySalary +
"Employee Description: " + description +
"Employee Department: " + department;
}
public void Print()
{
Console.WriteLine(this.ToString());
}
}