Metodo calcular importe hecho

parent 2ee85143
...@@ -69,8 +69,8 @@ public class UjapackApplication { ...@@ -69,8 +69,8 @@ public class UjapackApplication {
} }
//Prueba del metodo Calcular ruta //Prueba del metodo Calcular ruta y calcular importe
Envio e = new Envio("Jose","Maria","Almeria","Almeria",50,16,16,16); Envio e = new Envio("Jose","Maria","Almeria","Almeria",0.5f,20.4f,20.4f,20.4f);
ArrayList<PuntodeControl> j = new ArrayList<>(); ArrayList<PuntodeControl> j = new ArrayList<>();
j = e.calcularRuta(puntosdecontrol,e); j = e.calcularRuta(puntosdecontrol,e);
...@@ -79,6 +79,9 @@ public class UjapackApplication { ...@@ -79,6 +79,9 @@ public class UjapackApplication {
for(int i=0; i<j.size(); i++){ for(int i=0; i<j.size(); i++){
System.out.println(j.get(i)); System.out.println(j.get(i));
} }
float v = 0;
v = e.calcularImporte(e);
System.out.println(v);
//Fin de prueba del metodo calcular ruta. Esto debe pasarse a un test propio //Fin de prueba del metodo calcular ruta. Esto debe pasarse a un test propio
} }
......
...@@ -35,7 +35,14 @@ public class Envio { ...@@ -35,7 +35,14 @@ public class Envio {
this.listadoPuntos=new ArrayList<>(); this.listadoPuntos=new ArrayList<>();
} }
public void calcularImporte(){} //cambiar void por float
public float calcularImporte(Envio e){
float importe = 0;
importe = (e.getPeso()*e.getAlto()*e.getAncho()*e.getLargo()*((e.getListadoPuntos().size())+1)/1000);
return importe;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment