-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInforme.java
More file actions
81 lines (66 loc) · 2.34 KB
/
Informe.java
File metadata and controls
81 lines (66 loc) · 2.34 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
73
74
75
76
77
78
79
80
81
import java.time.LocalDate;
public class Informe {
private boolean TensionCinturones;
private Vehiculo vehiculo;
private double NivelGases;
private enum Estado {PROCESO,COMPLETADO};
private Estado EstadoTramitacion;
private int id;
private static int NumInforme=0;
private LocalDate fecha;
public Informe(Vehiculo vehic) {
NumInforme++;
id = NumInforme;
vehiculo = vehic;
EstadoTramitacion = Estado.PROCESO;
fecha =LocalDate.now();
}
public int getIdentificador() {
return id;
}
public void rellenar(double NivelGases, boolean TensionCinturones) {
this.NivelGases = NivelGases;
this.TensionCinturones = TensionCinturones;
EstadoTramitacion = Estado.COMPLETADO;
}
public boolean equals(Informe i) {
return i != null && id == i.getIdentificador();
}
public boolean pasaInspeccion() {
return vehiculo.pasaInspeccion(NivelGases) && TensionCinturones;
}
public String toString() {
return "Informe=[" + vehiculo + ", nivel de gases: " + NivelGases +
", pasa tension cinturones: " + ((TensionCinturones)?"si":"no")
+ ", estado tramitacion: " + EstadoTramitacion
+ ", fecha apertura: " + fecha + "]";
}
public static void main(String[] args) {
Vehiculo v1 = new Turismo("6438-KLV");
Vehiculo v2 = new Camion("3748-DYH");
Informe informes[] =new Informe[4];
Informe i1 = new Informe(v1);
Informe i2 = new Informe(v1);
Informe i3 = new Informe(v2);
Informe i4 = new Informe(v2);
System.out.println("INFORMES SIN DATOS ");
for(Informe i: informes)
System.out.println(i);
System.out.println("VEHICULOS PASANDO LA INSPECCION ");
i1.rellenar(1.6, true);
System.out.println("El vehiculo " + (i1.pasaInspeccion()?"si":"no")
+ " supera inspeccion.");
i2.rellenar(2.8, true);
System.out.println("El vehiculo " + (i2.pasaInspeccion()?"si":"no")
+ " supera inspeccion.");
i3.rellenar(3.2, true);
System.out.println("El vehiculo " + (i3.pasaInspeccion()?"si":"no")
+ " supera inspeccion.");
i4.rellenar(4.1, true);
System.out.println("El vehiculo " + (i4.pasaInspeccion()?"si":"no")
+ " supera inspeccion.");
System.out.println("INFORMES CON DATOS ");
for(Informe i: informes)
System.out.println(i);
}
}