I need to check, my int values which am giving as input should be only numerical value.
what is the alternate way to get for int value to be numeric.
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please enter salary");
int salary = Convert.ToInt32(Console.ReadLine());
******* Need to check the SALARY value to be only numeric value and not equal to null also*********
int Output = UserProgramCode.Bonus(salary);
Console.WriteLine("Output is: {0}", Output);
Console.ReadLine();
}
class UserProgramCode
{
public static int Bonus(int salary)
{
int b = 0;
if (salary < 0)
{
b = -1;
}
else if (salary > 10000 && salary < 15001)
{
b = 1200 + ((salary * 15) / 100);
}
else
{
b = 500 + ((salary * 8) / 100);
}
}
return b;
}
}