Moyenne.java 559 Bytes
package noyau;

import java.util.stream.Collectors;

public class Moyenne extends Fonctions{
	

	public String toString(){
		
		return "MOYENNE(" + listCases.stream()
		        .map( n -> n.getId() )
		        .collect( Collectors.joining( "," ) )
		        +")";
	}
	
	public String getFormuleDeveloppe(){
		
		return "";
	}
	
	public double eval() {
	    
		double val=0;

	    try{
	    	for(int i=0; i<listCases.size(); i++)
	    		val += listCases.get(i).getValeur();

	    	return val/ listCases.size();
	    }
	    catch(ArithmeticException ex){}
	}
}