Question: C# 1. Consider the following code for an Employee class and answer the questions that follow accordingly: class Employee { private double monthlySalary; public int
C#1. Consider the following code for an Employee class and answer the questions that follow accordingly: class Employee { private double monthlySalary; public int IdNum { get; set; } public string Name { get; set; } public double Monthlysalary { get; set; } public Employee(int id, string name, double salary) { id; Name - name; MonthlySalary - salary: } IdNum - public virtual double PayCheck (Employee employee) { MonthlySalary - monthlySalary; return monthlysalary; } public void Employee Info(Employee employee) { WriteLine("Employee (O} has an ID number of {1} and receives a monthly salary of {2}", Name, IdNum, MonthlySalary.ToString("C")); } } 1.1 How many members does the Employee class have? Mention them. 1.2 The header of the method PayCheck declares it as virtual. What does that mean? 1.3 Re-write the auto-implemented property MonthlySalary to impose a restriction on assigning only positive values for the salary. 1.4 Assume that CommissionEmployee is a child class of Employee. It inherits all the members of its parents and also have: an auto-implemented property called CommissionRate and another one called SalesAmount. Ac- cordingly, write a constructor for class Commission Employee. 1.5 Assume that the commissioned employee receives a monthly salary plus a commission that can be calculated as follows: Commission = Sales Amount * Commission Rate Commissioned Salary = Monthly Salary + Commission Accordingly, write a method in CommissonEmployee class that overrides the PayCheck method in the parent class to calculate the salary of commissioned employees. 1.6 Write two statements that create two objects, one for each class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
