Moyenne.java 591 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.0;

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

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