forked from harambeisnotdead/java-carande
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metodos.java
47 lines (35 loc) · 1.04 KB
/
metodos.java
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
import java.util.Scanner;
class metodos {
static Scanner scanner = new Scanner(System.in);
public static void main(String[] ARGUMENTOS) {
int num1,num2,OP_suma,OP_resta,OP_multi;
float OP_div;
num1 = LEER_NUMERO();
num2 = LEER_NUMERO();
OP_suma = SUMA(num1,num2);
OP_resta = RESTA(num1,num2);
OP_multi = MULTI(num1,num2);
OP_div = DIV(num1,num2);
VER_RESULTADOS(OP_suma,OP_resta,OP_multi,OP_div);
}
private static int LEER_NUMERO() {
System.out.print("Introduce un numero: ");
boolean a = true;
return scanner.nextInt();
}
public static int SUMA(int a, int b) {
return a + b;
}
public static int RESTA(int a, int b) {
return a - b;
}
public static int MULTI(int a, int b) {
return a * b;
}
public static float DIV(int a, int b) {
return a / b;
}
public static void VER_RESULTADOS(int sum, int res, int mul, float div) {
System.out.println("\n\tRESULTADOS:\n\n Suma: "+sum+"\n Resta: "+res+"\n Multiplicacion: "+mul+"\n Division: "+div+"\n");
}
}