0

I start an initial values in this method(SuccessRate) and change the values with the conditions. And I return the values. I'm expecting the values to be 0.9 but instead I get the value 0 when I use that method in my main method. What is wrong with my code? Thank you for reading my problems.

using System;
class Name
{
static void Main()
{
  Console.WriteLine (Assembly.Answer(5));

}
}
static class Assembly
{

public static double Answer(int speed)
{
    double success_rate = 0;
    if(speed == 0)
    {
       success_rate=0;
       
    }
    else if(speed >0 && speed <=4)
    {
      success_rate = 1;
     
    }
    else if(speed >=5 && speed <=8)
    {
        success_rate = 90/100;
        
    }

    else
    {
        success_rate = 1;
    }
    return success_rate;
}
}
John
  • 11

0 Answers0