I am trying to write a program to correctly diagnose what grade of fever they have

Viewed 19

When I type any number less than 104 it includes the dangerous fever output. For example, when I type 99.6 it outputs both low and dangerous fever when it should only output the low fever.

 temperature = sc.nextDouble();
    
    if (temperature<99.6)
    {
        System.out.println("The patient has no fever.");
    }
    else if(temperature >= 99.6 && temperature <= 102.0)
    {
        System.out.println("The patient has a low-grade fever.");
    }
    else if (temperature >= 102.1 && temperature <= 104.0)
    {
        System.out.println("The patient has a high-grade fever.");
    }
    else if (temperature >= 104.1);
    {
        System.out.println("The patient has a dangerous fever");
    }
0 Answers
Related