Question: using System; Gpublic class Employee { / / Private variables private string firstN; private string lastN; private int idNum; private double wage; private double [

using System;
Gpublic class Employee
{
// Private variables
private string firstN;
private string lastN;
private int idNum;
private double wage;
private double[] weekHrswkd = new double[4]; // weekly hours for 4 weeks
private const double regHrsAmt =40; ??? Fixed 40 hours
private double regpay;
private double otPay;
//Constructor
public Employee(string fn, string 1n, int id, double w)
{
firstN =fnj
lastN = ln;
idNum = id;
wage =w;
}
// Properties
public double[] WeeklyHours
{
get return weekHrswkd; }
set weekHrswkd = value; CalcPay();
}
public string FullName =>$ "firstN}{lastN}";
public double RegularPay => regPay;
public double overtimePay =>> otPay;
public double TotalPay => regPay + otPay;
//Method to calculate pay
public void CalcPay()
{
regPay =0;
otpay =0;
foreach (var hours in weekHrswkd)
{
if (hours = regHrsAmt)
{
}
regPay t= hours * wage;
else
{
regPay += regHrsAmt * wage;
otPay +=(hours - regHrsAmt)* wage *1.5;
}
}
}
 using System; Gpublic class Employee { // Private variables private string

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The code defines an Employee class in C Lets break down the key components Class Structure Private V... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!