-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTurismo.java
More file actions
45 lines (34 loc) · 1.15 KB
/
Turismo.java
File metadata and controls
45 lines (34 loc) · 1.15 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
public class Turismo extends Vehiculo{
public Turismo(String matricula) {
super(matricula);
}
public boolean pasaInspeccion(double NivelGases){
if(NivelGases<2);
return true;
}
public static void main (String[] args) {
Turismo Turismos[]=new Turismo[5];
Turismo T1= new Turismo("6438-KLV");
Turismo T2= new Turismo("3794-HDI");
Turismo T3= new Turismo("9203-DJE");
Turismo T4= new Turismo("3023-SKO");
Turismo T5= new Turismo("4203-DEW");
for(int i=0; i<Turismos.length; i++) {
if(Turismos[i].equals(Turismos[4].getMatricula()))
System.out.println("Vehiculos: " + Turismos[i] + " y " + Turismos[4]
+ " son iguales");
else{
}
}
java.util.Scanner scan = new java.util.Scanner(System.in);
System.out.println("Matricula del coche que quiere localizar: ");
String matricula = scan.nextLine();
scan.close();
boolean localizado = false;
for(int i=0; i<Turismos.length && !localizado; i++){
localizado = Turismos[i].equals(matricula);
System.out.println((localizado?"Si":"No")
+ "localizado el vehiculo con matricula " + matricula);
}
}
}