1 | package com.epam.bootcamp.bmi_calculator; | |
2 | ||
3 | import com.epam.bootcamp.bmi_calculator.interfacesImplements.*; | |
4 | ||
5 | public class App extends Exception | |
6 | { | |
7 | ||
8 | private double weight; | |
9 | private double height; | |
10 | private double bmi; | |
11 | | |
12 | /** | |
13 | * A ZeroChecker megnézi, hogy nulla vagy kevesebb-e a súly vagy a magasság. | |
14 | * Ha valamelyik nulla vagy kevesebb, akkor hibát dob. | |
15 | */ | |
16 | private void ZeroChecker() throws Exception{ | |
17 |
2
1. ZeroChecker : changed conditional boundary → KILLED 2. ZeroChecker : negated conditional → KILLED |
if(this.weight <= 0){ |
18 | throw new Exception("Weight is equals or less than zero."); | |
19 | } | |
20 |
2
1. ZeroChecker : changed conditional boundary → SURVIVED 2. ZeroChecker : negated conditional → KILLED |
if(this.height <= 0){ |
21 | throw new Exception("Height is equals or less than zero."); | |
22 | } | |
23 | } | |
24 | | |
25 | /** | |
26 | * Ez adja értéknek a BMI-t a bmi változónak. | |
27 | * Először megnézi a ZeroCheckerrel a kapott értékeket. | |
28 | * Meghívja a GuessTheUnits osztályt, ami kitalálja, hogy milyen mértékegységekkel számoljuk a BMI-t(US vagy metric). | |
29 | * Attól függően, hogy mi a mértékegység, hívjuk meg a számolót. | |
30 | * @return a bmi értékével tér vissza a metódus | |
31 | * @throws Exception | |
32 | */ | |
33 | public double calculateBMI() throws Exception{ //végül kiszámoljuk a BMI-t | |
34 |
1
1. calculateBMI : removed call to com/epam/bootcamp/bmi_calculator/App::ZeroChecker → SURVIVED |
ZeroChecker(); |
35 | GuessTheUnits gtu = new GuessTheUnits(this.height, this.weight); | |
36 |
1
1. calculateBMI : negated conditional → KILLED |
if(gtu.getUnitType().equals("US")){ |
37 | UsBMI ubmi = new UsBMI(); | |
38 |
1
1. calculateBMI : removed call to com/epam/bootcamp/bmi_calculator/interfacesImplements/UsBMI::setBMI → KILLED |
ubmi.setBMI(gtu.getWeight(), gtu.getHeight()); |
39 | this.bmi = ubmi.getBMI(); | |
40 |
1
1. calculateBMI : negated conditional → KILLED |
}else if(gtu.getUnitType().equals("metric")){ |
41 | MetricBMI mbmi = new MetricBMI(); | |
42 |
1
1. calculateBMI : removed call to com/epam/bootcamp/bmi_calculator/interfacesImplements/MetricBMI::setBMI → KILLED |
mbmi.setBMI(gtu.getWeight(), gtu.getHeight()); |
43 | this.bmi = mbmi.getBMI(); | |
44 | } | |
45 |
1
1. calculateBMI : replaced double return with 0.0d for com/epam/bootcamp/bmi_calculator/App::calculateBMI → KILLED |
return this.bmi; |
46 | } | |
47 | | |
48 | /** | |
49 | * A bmi változó értékétől függően kapjuk meg az adott ember értékelését | |
50 | * @return Egy string, ami tartalmazza az értékelést | |
51 | */ | |
52 | public String bmiResult(){ | |
53 |
2
1. bmiResult : changed conditional boundary → SURVIVED 2. bmiResult : negated conditional → KILLED |
if(this.bmi < 18.5){ // Sovány |
54 |
1
1. bmiResult : replaced return value with "" for com/epam/bootcamp/bmi_calculator/App::bmiResult → KILLED |
return "Thinness"; |
55 |
4
1. bmiResult : changed conditional boundary → SURVIVED 2. bmiResult : changed conditional boundary → SURVIVED 3. bmiResult : negated conditional → KILLED 4. bmiResult : negated conditional → KILLED |
}else if(this.bmi >= 18.5 && this.bmi <= 24.9){ // Normál testalkatú |
56 |
1
1. bmiResult : replaced return value with "" for com/epam/bootcamp/bmi_calculator/App::bmiResult → KILLED |
return "Normal"; |
57 |
4
1. bmiResult : changed conditional boundary → SURVIVED 2. bmiResult : changed conditional boundary → SURVIVED 3. bmiResult : negated conditional → KILLED 4. bmiResult : negated conditional → KILLED |
}else if(this.bmi > 24.9 && this.bmi <= 29.9){ // Túlsúlyos |
58 |
1
1. bmiResult : replaced return value with "" for com/epam/bootcamp/bmi_calculator/App::bmiResult → KILLED |
return "Overweight"; |
59 | }else{ // Erősen túlsúlyos | |
60 |
1
1. bmiResult : replaced return value with "" for com/epam/bootcamp/bmi_calculator/App::bmiResult → KILLED |
return "Heavily overweight"; |
61 | } | |
62 | } | |
63 | | |
64 | /** | |
65 | * Súly beállítása | |
66 | * @param weight a súly | |
67 | */ | |
68 | public void setWeight(double weight){ | |
69 | this.weight = weight; | |
70 | } | |
71 | | |
72 | /** | |
73 | * Magasság beállítása | |
74 | * @param height a magasság | |
75 | */ | |
76 | public void setHeight(double height){ | |
77 | this.height = height; | |
78 | } | |
79 | } | |
Mutations | ||
17 |
1.1 2.2 |
|
20 |
1.1 2.2 |
|
34 |
1.1 |
|
36 |
1.1 |
|
38 |
1.1 |
|
40 |
1.1 |
|
42 |
1.1 |
|
45 |
1.1 |
|
53 |
1.1 2.2 |
|
54 |
1.1 |
|
55 |
1.1 2.2 3.3 4.4 |
|
56 |
1.1 |
|
57 |
1.1 2.2 3.3 4.4 |
|
58 |
1.1 |
|
60 |
1.1 |