PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are developing an application for a bank. The application includes a method named
ProcessLoan that processes loan applications. The ProcessLoan() method uses a method
named CalculateInterest. The application includes the following code:

You need to declare a delegate to support the ProcessLoan() method.
Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
Option A

B.
Option B

C.
Option C

D.
Option D

8 Comments on “Which code segment should you use?

  1. Mah says:

    Code could be like this this:
    class Program
    {
    public delegate decimal CalculateInterest(decimal loanAmount, decimal loanRate, int term);
    static void Main()
    {

    CalculateInterest cal = ProcessLoan;
    decimal retvalue = cal.Invoke(12, 1, 2);
    Console.WriteLine(retvalue);

    CalculateInterest cal2 = new CalculateInterest(ProcessLoan);
    Console.WriteLine(cal2.Invoke(12, 1, 2));

    }

    static public decimal ProcessLoan(decimal loanAmount, decimal loanRate, int term)
    {
    decimal returnValue = loanRate / loanAmount * term;
    return returnValue;
    }
    }




    0



    0

Leave a Reply