Programme java aidez moi svp

othman -  
 ray_fab -
ecrire un programme qui remplit les notes des etudiants dans un tableau et calcule la moyenne de chaque étudiants
Configuration: Windows XP
Internet Explorer 6.0

1 réponse

  1. ray_fab
     
    Bonsoir voici un exemple simple fait avec entrée d'utilisateur :Bon courage
    import java.io.*;
    public class essai {
    static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
    public static double calcul(int n)throws IOException{
    double moy[]=new double[n];
    double som=0.0;
    for(int i=0;i<moy.length;i++){
    System.out.print("moyenne de l'etudiant:"+i);
    String ligne=in.readLine();
    moy[i]=Double.parseDouble(ligne);

    }
    System.out.println();
    for(int j=0;j<moy.length;j++){som+=moy[j];}
    return som/n;
    }
    public static void main(String args[]){
    try{
    System.out.println(essai.calcul(3));
    }
    catch(IOException ioe){
    System.err.println(ioe.getMessage());
    }
    }
    }
    0