Ad
  • Custom User Avatar

    No, I tried BigNum but that didn't help. The only one solution that comes to my mind (besides fixing tests) is to write a function that mimic floats rounding of the original platform/ruby version/language.

  • Default User Avatar

    It's all wrong, the test cases for submit are wrong. Should be something like this.

    import java.util.Random;
    import static org.junit.Assert.assertEquals;
    import org.junit.Test;

    public class PruebasCelsius {
    String solution(int temperture) {
    int c = (int) ((temperture - 32) * (5/9.0));
    return c + (c <= 0 ? " is freezing temperature" : " is above freezing temperature");
    }

    @Test
    public void test1() {
        assertEquals(solution(56), GrassHopper.weatherInfo(56));
    }
    @Test
    public void test2() {
        assertEquals(solution(23), GrassHopper.weatherInfo(23));
    }
    @Test
    public void test3() {
        assertEquals(solution(33), GrassHopper.weatherInfo(33));
    }
    @Test
    public void test4() {
        assertEquals(solution(5), GrassHopper.weatherInfo(5));
    }
    @Test
    public void test5() {
        Random rand = new Random();
        for (int i = 0; i < 50; i++) {
            int num = rand.nextInt(100)+1;
            assertEquals(solution(num), GrassHopper.weatherInfo(num));
        }
    }
    

    }