package weight;
import java.util.*;
public class Weight {
public static void main(String[] args) {
double height,weight;
Scanner input=new Scanner(System.in);
System.out.println("Please enter your weight:");
weight=input.nextDouble();
System.out.println("Please enter your height:");
height=input.nextDouble();
if (weight<height/2.5)
{
System.out.println("Underweight");
}
else {
if (height/2.5==weight==height/2.3)
{
System.out.println("Normal");
}
else {
if (height/2.3<weight)
System.out.println("Overweight");
}
}
}
}
The error appears to be in
if (height/2.5==weight==height/2.3)
it says "incomparable types: boolean and double"
how can I modify the code so that it can work properly? Thank you
Aucun commentaire:
Enregistrer un commentaire