-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVucutKutleIndeksi.java
More file actions
55 lines (36 loc) · 1.19 KB
/
VucutKutleIndeksi.java
File metadata and controls
55 lines (36 loc) · 1.19 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
52
53
54
55
/*
Soru: Kullanıcıdan boy (cm) ve kilo (kg) değerlerini alan; boy/kilo oranı 2'den küçükse "şişman",
2-2.5 arasıysa "normal", 2.5'ten büyükse "zayıf" yazan programı kodlayınız.
*/
import java.util.Scanner;
public class VucutKutleIndeksi {
int boy;
double kilo;
public VucutKutleIndeksi(int boy, double kilo) {
this.boy = boy;
this.kilo = kilo;
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Lütfen boyunuzu giriniz(cm cinsinden): ");
int boy = scanner.nextInt();
System.out.print("Lütfen kilonuzu girniz(kg cinsinden): ");
double kilo = scanner.nextDouble();
VucutKutleIndeksi app = new VucutKutleIndeksi(boy, kilo);
app.durumuYazdir();
scanner.close();
}
double indexHesapla() {
return boy / kilo;
}
void durumuYazdir() {
double sonuc = indexHesapla();
if (sonuc < 2) {
System.out.println("Şişman");
} else if (2 < sonuc && sonuc < 2.5) {
System.out.println("Normal");
} else {
System.out.println("Zayıf");
}
}
}