probleme d'execution un petit problme
salut les amis
je travaille sut netbeanside
mais malheureusement ce petit programme ce compile mai il n'excute pas
le voila aidez svp il va me rendre dingue :D
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
| package eleve;
import java.util.*;
public class classeleve {
String nom;
int nbnote;
int[] note;
public void Eleves(String nom,int nbnote)
{
this.nom=nom;
this.nbnote=nbnote;
}
public int GetNote(int num)
{
return note[num];
}
public void SetNote(int num,int note)
{
this.note[num]=note;
}
public void setNotes( int [ ] a )
{
}
public void SaisirNote()
{
Scanner input=new Scanner(System.in);
System.out.println("entrez les note du l'eleve :("+ nom +")");
for(int i=0;i<nbnote;i++)
{
System.out.println("entrez la note num ("+ i +")");
note[i]=input.nextInt();// c'est la ou il arrête d'exécuter
}
}
public double Moyenne( )
{
int i=0,somme=0, moyenne=0;
while(i<nbnote)
{
somme+=note[i];
i++;
}
moyenne=somme/i;
return somme;
}
public int Notemaximale( )
{
int i=0,max=note[0];
for(i=1;i<nbnote;i++)
{
if(max<note[i])
max=note[i];
}
return max;
}
public int Noteminimal( )
{
int i=0,min=note[0];
while(i<nbnote)
{
if(min>note[i])
min= note[i];
}
return min;
}
public void afficher()
{
System.out.println(nom);
for(int elements:note)
System.out.println(elements);
}
}
le main le voila
public class Main {
public static void main(String[] args)
{
classeleve Dupont=new classeleve();
classeleve Durant=new classeleve();
String x="Dupont";
String c="Durant";
Dupont.Eleves(x,3);
Durant.Eleves(c,3);
Dupont.SaisirNote();
Durant.SaisirNote();
Durant.afficher();
Dupont.afficher();
}
} |