-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path09. Calculo IMC.java
More file actions
51 lines (45 loc) · 1.39 KB
/
09. Calculo IMC.java
File metadata and controls
51 lines (45 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package exercicio06.imc;
import java.util.Scanner;
/**
*
* @author diego.fernandes
*/
public class Exercicio06IMC {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner ent = new Scanner(System.in);
Scanner boo = new Scanner(System.in);
Scanner foo = new Scanner(System.in);
String a,sexo;
float h, p =0, m = 72.7f, f= 62.1f;
System.out.print("Qual é o seu nome? ");
a = ent.nextLine();
System.out.print("Qual é o seu sexo? [M/F] ");
sexo = boo.nextLine();
System.out.println("Qual é sua altura? ");
h = foo.nextFloat();
if (sexo.equals('M')){
p = (m*h)- 58;
}
if (sexo.equals('F')){
p = (f*h)- 44.7f;
}
System.out.println("Nome: " + a);
if (sexo.equals('M')) {
System.out.println("Sexo: Masculino");}
if (sexo.equals('F')){
System.out.println("Sexo: Feminino");
}
System.out.format("Seu peso ideal é: %.2f", (p));
System.out.println(" ");
System.out.println("Fim");
}
}