Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Etudiant{
- static
- {
- nbEtu = 0;
- }
- private static int nbEtu;
- private int matricule; // question private/protected/public
- private String nom;
- private static int nbNotes;
- private int tab[] = new int[3]; // déclaration du tab
- public Etudiant(){
- this("",0);
- }
- public Etudiant(String nom, int nbNotes){
- nbEtu++;
- matricule = nbEtu;
- this.nom=nom;
- this.nbNotes=nbNotes;
- int tab[] = new int[nbNotes];
- }
- public void saisie(){
- int i;
- for(i=0;i<tab.length;i++){
- Scanner clavier = new Scanner(System.in);
- tab[i] = clavier.nextInt();
- System.out.println("la note numero " + i+1 + " est de : " + tab[i]);
- }
- }
- public int getNb(){return nbNotes;}
- public float moyenne(){
- float moy=0.f;
- int i;
- for(i=0;i<tab.length;i++){
- moy=moy+tab[i];
- }
- return moy/nbNotes;
- }
- public void affiche(){
- System.out.println(matricule + nom + nbNotes + moyenne());
- }
- public Etudiant clone(){
- //a= b.clone()
- Etudiant name = new Etudiant(this.nom, this.nbNotes);
- name.matricule = this.matricule;
- return name;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement