How should you complete the code?

DRAG DROPYou are developing a function that takes a parameter named aParam as a string input.
You need to convert aParam to a Double. If the conversion cannot be completed, the function should return 0.

How should you complete the code? To answer, drag the appropriate code elements to the correct targets in
the answer area. Each code element may be used once, more than once, or not at all. You may need to drag
the split bar between panes or scroll to view content.
Select and Place:

DRAG DROPYou are developing a function that takes a parameter named aParam as a string input.
You need to convert aParam to a Double. If the conversion cannot be completed, the function should return 0.

How should you complete the code? To answer, drag the appropriate code elements to the correct targets in
the answer area. Each code element may be used once, more than once, or not at all. You may need to drag
the split bar between panes or scroll to view content.
Select and Place:

Answer:



Leave a Reply 2

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


jonny

jonny

double
double
out

Swapnil

Swapnil

double
double
out
class Program
{
public double ConvertTheDouble(string aParam)
{
double result;
if (!double.TryParse(aParam, out result)) return 0;
return result;

}
static void Main(string[] args)
{
Program p = new Program();

Console.WriteLine(p.ConvertTheDouble(“100.32323”));
Console.WriteLine(p.ConvertTheDouble(“Sachin”));
Console.ReadLine();
}
}