package progusingjava;
//DO NOT MODIFY THE CODE PROVIDED TO YOU
public class TransportFacility { private static String[] locationArr={"Northyork", "Scarborough", "Etobicoke"}; private static double[] transportCostArr={1500.0, 1000.0, 2000.0}; private double transportFee; private int distance;
public TransportFacility(int distance) { this.distance = distance; } public double getTransportFee() { return this.transportFee; } //To Trainees public double identifyTransportFee(String location) { this.transportFee = 0.0; if (this.distance > 0) { for (int i = 0; i < locationArr.length; i++) { if (locationArr[i].equals(location)) { this.transportFee = transportCostArr[i]; break; } } } return this.transportFee; } @Override public String toString() { return "TransportFacility (distance=" + this.distance + ")"; }
}
Some comments have been hidden by the post's author - find out more
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
package progusingjava;
//DO NOT MODIFY THE CODE PROVIDED TO YOU
public class TransportFacility {
private static String[] locationArr={"Northyork", "Scarborough", "Etobicoke"};
private static double[] transportCostArr={1500.0, 1000.0, 2000.0};
private double transportFee;
private int distance;
}