Skip to content
Snippets Groups Projects
Commit 705262cd authored by ivagonz's avatar ivagonz
Browse files

Implementada la clase DireccionGPS, pasando todos los test TDD

parent d11789df
Branches
No related tags found
1 merge request!1Direccion gps
package uva.tds.pr2.equipo10;
/**
* Implementación de una DirecciónGPS para la segunda práctica de la asignatura
* TDS.
......@@ -10,6 +9,9 @@ package uva.tds.pr2.equipo10;
*/
public class DireccionGPS {
private double latitud;
private double longitud;
/**
* Constructor de una dirección GPS.
*
......@@ -24,24 +26,33 @@ public class DireccionGPS {
* los argumentos del constructor.
*/
public DireccionGPS(double latitud, double longitud) {
int a = 0;
if (latitud < -180)
throw new IllegalArgumentException("La latitud debe ser mayor o igual a -180");
if (latitud > 180)
throw new IllegalArgumentException("La latitud debe ser menor o igual a 180");
if (longitud < -180)
throw new IllegalArgumentException("La longitud debe ser mayor o igual a -180");
if (longitud > 180)
throw new IllegalArgumentException("La longitud debe ser menor o igual a 180");
this.latitud = latitud;
this.longitud = longitud;
}
/**
* @return latitud de la DireccionGPS.
*/
public int getLatitud() {
public double getLatitud() {
// TODO Auto-generated method stub
return 0;
return latitud;
}
/**
*
* @return longitud de la DireccionGPS .
*/
public int getLongitud() {
public double getLongitud() {
// TODO Auto-generated method stub
return 0;
return longitud;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment