-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPesoIdeal.java
More file actions
36 lines (28 loc) · 1001 Bytes
/
PesoIdeal.java
File metadata and controls
36 lines (28 loc) · 1001 Bytes
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
import java.util.Scanner;
public class PesoIdeal {
public static void main(String[] args) {
double alt, pesoIdeal;
String sexo;
int i=0, resp;
Scanner in = new Scanner(System.in);
do {
System.out.println("Qual o seu sexo? (Digite f para FEMININO ou m para MASCULINO)");
sexo = in.next();
System.out.println("Qual a sua altura em centímetros?");
alt = in.nextDouble();
if (sexo.equalsIgnoreCase("f")) {
pesoIdeal = 52 + (0.67 *(alt - 152.4));
System.out.printf("O seu peso ideal é de %.2f", pesoIdeal);
}else if (sexo.equalsIgnoreCase("m")){
pesoIdeal = 52 + (0.75 *(alt - 152.4));
System.out.printf("O seu peso ideal é de %.2f", pesoIdeal);
}else {
System.out.println("Altura ou sexo informados incorretamente.");
}
System.out.println("Deseja continuar a execução? (1-para SIM ou 2-para NãO)");
resp = in.nextInt();
i++;
} while (resp == 1);
in.close();
}
}