The following code is included in the CalcSalary class:

You have been given the responsibility of creating a class named CalcSalary that will determine the salaries of Domain.com’s staff.
The CalcSalary class includes methods to increment and decrement staff salaries. The following code is included in the CalcSalary class:
public class CalcSalary {
// for promotions
public static bool IncrementSalary (Employee Emp, double Amount){
if (Emp.Status == QuarterlyReview.AboveGoals)
Emp.Salary += Amount;
return true;

You have been given the responsibility of creating a class named CalcSalary that will determine the salaries of Domain.com’s staff.
The CalcSalary class includes methods to increment and decrement staff salaries. The following code is included in the CalcSalary class:
public class CalcSalary {
// for promotions
public static bool IncrementSalary (Employee Emp, double Amount){
if (Emp.Status == QuarterlyReview.AboveGoals)
Emp.Salary += Amount;
return true;

A.
public delegate bool Salary (Employee Emp, double Amount);

B.
public bool Salary (Employee Emp, double Amount);

C.
public event bool Salary (Employee Emp, double Amount);

D.
public delegate void Salary (Employee Emp, double Amount);

Explanation:
The signatures of the delegate and the attached method(s) should be identical. When you declare a delegate, you use the delegate keyword followed by the return type. If you bind the delegate to a method with a return type, you should specify that. If you bind the delegate to a method that does not return a data type, you should use the void keyword. After that, you should specify the name of the delegate and declare the arguments expected. In this scenario, the IncrementSalary and DecrementSalary methods accept an
Employee object and a double value, and return a Boolean value. You should, therefore, accept an Employee object and a double value, and return a Boolean value when you declare the SalaryDelegate delegate.
Incorrect Answers:
B: You should not us the code that does not use the delegate keyword.
C: You should not us the code that declares an event named SalaryDelegate.
D: You should not us the code that uses the void keyword because both the IncrementSalary and DecrementSalary methods return a Boolean value.



Leave a Reply 1

Your email address will not be published. Required fields are marked *


seenagape

seenagape

Correct answer is A