Question: 4 : Create an Employee Class C# Create a class to represent an employee and calculate their salary based on work hours and hourly wage.

4: Create an Employee Class
C# Create a class to represent an employee and calculate their salary based on work hours and hourly wage.
Instructions:
Define an Employee class:
The class should have the following private fields:
string Name
double HourlyWage
double HoursWorked
Create a constructor that takes the employee's name and hourlyWage as parameters, and initializes the HoursWorked to 0.
Add a method LogHours(double hours) that adds the given hours to HoursWorked.
Add a method CalculateSalary() that returns the total salary based on the HourlyWage and HoursWorked.
Add a method PrintEmployeeInfo() that prints the employee's name, hours worked, hourly wage, and total salary.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Programming Questions!