Hello everyone, my question is that I am trying to get an array of objects from another class, by parameter, to the class I want to put the array by parameter.
The classes are: Course and Costs
I have to get by parameter an array of objects of the type Route, to then be able to calculate. Here is the code:
Class Path :
public class Percurso {
private double kmPercorrida;
private double valorCombustivel;
private double valorPedagio;
public Percurso() {
this(0,0,0);
}
public Percurso(double kmPercorrida, double valorCombustivel,
double valorPedagio) {
this.kmPercorrida = kmPercorrida;
this.valorCombustivel = valorCombustivel;
this.valorPedagio = valorPedagio;
}
Class Costs :
public class Custos {
public String calcularViagem(Percurso [] p ) {
return "";
}
}
In the Route [] p part, I need to pass the Route object array, with the variables kmPercubage, FuelValue, PagerPage .
NOTE: In the return I just left so no problems appear, then I change.
How can I do this? If anyone knows please help me. And sorry if the format of the post is wrong, I'm new here in the forum. I've also read how to make a decent post but still any mistake, please let me know what I'll do.