Java - simulación de rastreo

 
Vista:
sin imagen de perfil

simulación de rastreo

Publicado por Gabrield (6 intervenciones) el 11/12/2015 23:10:12
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
import java.awt.*;
import java.util.Scanner;
import java.util.Vector;
 
class Smartphone {
 
	private String modelo;
	private String marca;
	private int Codigo;
	private double ConsumoEnergia;
	private double tiempo;
 
	public Smartphone(String modelo,String marca, int Codigo,double ConsumoEnergia,double tiempo) {
	//public Smartphone(String modelo,String marca,int Codigo) {
 
	this.modelo = modelo;
	this.marca = marca;
	this.Codigo = Codigo;
	this.ConsumoEnergia = ConsumoEnergia;
	this.tiempo = tiempo;
}
 
	public String getModelo (){
	return modelo;
}
	public String getMarca () {
	return marca;
}
	public int getCodigo(){
	return Codigo;
}
	public double getConsumoEnergia(){
	return ConsumoEnergia;
}
	public double getTiempo () {
	return tiempo;
}
 
}
// crear un conte
 
class Rastreador {
	private Vector<Smartphone> celular;
	private String tipoRastreador;
	//private String ubicacion;
 
	public Rastreador (Vector<Smartphone> celular,String tipoRastreador){
 
	this.celular = celular;
	this.tipoRastreador = tipoRastreador;
//	this.ubicacion = ubicacion;
}
	public Vector<Smartphone> getCelular () {
 
	return this.celular;
}
	public String getTipoRastreador (){
 
	return this.tipoRastreador;
}
//	public String getUbicacion () {
 
//	return ubicacion;
//}
}
 
class Rastreo {
 
	public static void main (String[]args) {
 
	Scanner Ub = new Scanner(System.in);
	String ubicacion1 = "San juan";
	String ubicacion2 = "Santiago";
	String ubicacion3 = "Elias Pina";
	String ubicacion4 = "La Vega";
	String ubicacion5 = "Dajabon";
	double consumo,tiempo;
 
	Smartphone tipo1 = new Smartphone("Galaxy s5","Samsung",10015,23.1,2.0);
	Smartphone tipo2 = new Smartphone("Lumia","Nokia",19283,30.1,4.0);
	Smartphone tipo3 = new Smartphone("Android g5","Google",2237746,40,4.0);
	Smartphone tipo4 = new Smartphone("iPhone 5","Apple",938384,25.1,2.0);
	Smartphone tipo5 = new Smartphone("Galaxy s4","Samsung",2938,35.1,2.0);
 
	Vector<Smartphone> cel = new Vector<Smartphone>();
	cel.add(tipo1);
	cel.add(tipo2);
	cel.add(tipo3);
	cel.add(tipo4);
	cel.add(tipo5);
 
	Rastreador soft =  new Rastreador(cel,"spysoft");
	//Rastreador cel1 = new Rastreador("Samsung Galaxy s5,modelo no.10015 ","Gps");
	//Rastreador cel2 = new Rastreador("Nokia Lumia,modelo no.19283 ","Gps");
	//Rastreador cel3 = new Rastreador("Android g5,modelo no.2237746 ","Gps");
	//Rastreador cel4 = new Rastreador("iPhone 5,modelo no.938384 ","Gps");
	//Rastreador cel5 = new Rastreador("Samsung Galaxy s4,modelo no.2938 ","Gps");
 
	System.out.print("Introduzca el Consumo de Energia (en Voltios): ");
	//ConsumoEnergia = Ub.nextDouble();
	consumo = Ub.nextDouble();
	System.out.print("Introduzca el Tiempo (en Horas): ");
	tiempo = Ub.nextDouble();
 
	//if (ConsumoEnergia <= 23.1 && tiempo == 2){
		if (consumo <= 23.1 && tiempo == 2) {
	//System.out.print("El celular es un: "+cel1"y esta en "+ubicacion1);
		System.out.print(tipo1);
		System.out.printf( "Esta en:"+ ubicacion1);
	}	else
		//    if (ConsumoEnergia <= 25.1 && tiempo == 2){
				if (consumo <= 25.1 && tiempo == 2) {
		//System.out.print("El celular es un: "+cel4"y esta en "+ubicacion2);
		    	System.out.print(tipo4);
				System.out.print("Esta en : "+ ubicacion2);
		}	else
			//    if (ConsumoEnergia <= 30.1 && tiempo == 4) {
					if (consumo <= 30.1 && tiempo == 4){
			//System.out.print("El celular es un: "+cel2"y esta en "+ubicacion3);
			    	System.out.print(tipo2);
					System.out.print("Esta en : "+ ubicacion3);
			} else
			  //   if (ConsumoEnergia<= 35.1 && tiempo == 2) {
					if(consumo <= 35.1 && tiempo == 2) {
				//System.out.print("El celular es un: "+cel5"y esta en "+ubicacion4);
			     	System.out.print(tipo5);
					System.out.print("Esta en : "+ ubicacion4);
 
			}	else
				//	if(ConsumoEnergia >= 40 && tiempo == 4){
						if (consumo >= 40 && tiempo == 4) {
					//System.out.print("El celular es un: "+cel3"y esta en "+ubicacion5);
						System.out.print(tipo3);
						System.out.print("Esta en : "+ ubicacion5);
 
					}
 
}
 
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
-1
Responder
Imágen de perfil de Jordi

simulación de rastreo

Publicado por Jordi (38 intervenciones) el 12/12/2015 08:48:36
Hola Gavriel,

¿cuál es la pregunta?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de xve
Val: 686
Bronce
Ha mantenido su posición en Java (en relación al último mes)
Gráfica de Java

simulación de rastreo

Publicado por xve (345 intervenciones) el 12/12/2015 11:20:39
Este código esta incompleto verdad??
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar