


public class Taxi extends Transport{
	
	double coeff;

	public Taxi(String nom, double coeff) {
		super(nom);
		this.coeff = coeff;
	}

	public double getCoeff() {
		return coeff;
	}

	@Override
	double prixBillet(Lieu origine, Lieu destination) {
		double distance = 0;
		double prix;
		if(!origine.equals(destination)){
			if(origine.getX() == destination.getX()){
				distance = (origine.getY()-destination.getY());
			}
			else if(origine.getY() == destination.getY()){
				distance = (origine.getX()-destination.getX());
			}
			else{
				distance = (origine.getY()-destination.getY()) / (origine.getX() - destination.getX());
				if (distance < 0) distance = -distance;
			}

		}

		prix = distance * coeff;
		return prix;
		//return 0;
	}
	
	public String toString(){
		return "taxi \"<"+super.getNom()+">\"";
	}
	
	

}
