-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDocComments.java
More file actions
72 lines (58 loc) · 2.09 KB
/
DocComments.java
File metadata and controls
72 lines (58 loc) · 2.09 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
public class DocComments {
//Para documentar un método se toman en cuenta, el nombre de la función, los parámetros con su tipo de dato, lo que devuelve con su tipo de dato y lo que hace la función. Mira estos ejemplos y resuelve el ejercicio final.
//Si escribes primero la función y luego sobre ella escribes /** */ te saldrá automáticamente la plantilla de documentación.
public static void main(String[] args) {
greeting();
greetingCoder("Alex", 155, 44.50);
double bmi = calculateBodyMassIndex(1.55, 44.50);
System.out.println(bmi);
//Ejecuta el nuevo método
}
/**
* Function name: greeting
*
* Inside the function:
* 1. prints "Hola FemCoder"
*
*/
public static void greeting(){
System.out.println("Hola FemCoder");
}
/**
* Function name: greetingCoder
*
* @param name (String)
* @param height (double)
* @param weight (double)
*
* Inside the function:
* 1. print the name the height and the weight as part of a text
*/
public static void greetingCoder(String name, double height, double weight){
System.out.println("Hola mi nombre es " + name + " mido " + height + " cm y peso " + weight + " kg" );
}
/**
* Function name: calculateBodyMassIndex
*
* @param height (double)
* @param weight (double)
* @return (double)
*
* Inside the function:
* 1. calculates the weight in kilograms by the squared height in meters and return it.
*/
public static double calculateBodyMassIndex(double height, double weight){
double bmi = weight / Math.pow(height, 2);
return bmi;
}
//Escribe una función que con el índice de masa corporal devuelva un String con los resultados y documéntala:
/* Clasificación índice de masa corportal rango - kg/m2
Delgadez severa < 16
Delgadez moderada 16 - 17
Delgadez leve 17 - 18.5
Normal 18.5 - 25
Sobrepeso 25 - 30
Obeso Clase I 30 - 35
Obeso Clase II 35 - 40
Obeso Clase III > 40 */
}