0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

 初心者:30行目にエラーがでます。どこを直せばいいかわかりません。

Posted at

以下の文で、30行目にエラーがでます。どなたかわかるかた教えていただけないでしょうか?
※30行目に☆がしてあります。

import java.util.Scanner;

class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

System.out.println("名前:");
String firstName = scanner.next();
System.out.println("名字:");
String lastName = scanner.next();
System.out.println("年齢:");
int age = scanner.nextInt();
System.out.println("身長(m):");
double height = scanner.nextDouble();
System.out.println("体重(kg):");  
double weight = scanner.nextDouble();

sub(firstName,lastName,age,height,weight);

}

public static void sub(String firstName, String lastName, int age, double height, double weight)
{
System.out.println("名前は"+firstName+" "+lastName+"です");
System.out.println("年齢は"+age+"歳です");
if(age>=20){System.out.println("成年者です");}
else{System.out.println("未成年者です");}
System.out.println("身長は" +height+ "mです");
System.out.println("体重は" +weight+ "kgです");
System.out.println("BMIは" + Math.round(bmi(weight,height)) + "です");
☆ if (isHealthy(bmi)){System.out.println("健康です");}
else{System.out.println("健康ではありません");}

}

public static double bmi(double weight, double height){
return weight / height / height;
}

public static boolean isHealthy(double bmi){
return bmi>=18.5&&bmi<25;

}

}

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?