-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA105.java
62 lines (51 loc) · 1.79 KB
/
A105.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import java.util.Scanner;
public class A105 {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
double importe = sc.nextDouble();
String[] dias = {"MARTES","MIERCOLES","JUEVES","VIERNES","SABADO","DOMINGO"};
while (importe != -1) {
int max = 0;
int min = 0;
double importeMax = importe;
double importeMin = importe;
double media = importe;
Boolean empateMax = false;
Boolean empateMin = false;
for (int i=1; i < 6; i++) {
importe = sc.nextDouble();
media += importe;
if (importe < importeMin) {
importeMin = importe;
min = i;
empateMin = false;
} else if (importe == importeMin) {
empateMin = true;
} else if (importe > importeMax) {
importeMax = importe;
max = i;
empateMax = false;
} else if (importe == importeMax) {
empateMax = true;
}
}
media = media / 6;
if (empateMax) {
System.out.print("EMPATE ");
} else {
System.out.print(dias[max] + " ");
}
if (empateMin) {
System.out.print("EMPATE ");
} else {
System.out.print(dias[min] + " ");
}
if (importe > media) {
System.out.println("SI");
} else {
System.out.println("NO");
}
importe = sc.nextDouble();
}
}
}