Bonjour,

J'ai crée une programme de compagnie aérienne contenant chacune des vols et avions.
Seulement quand j’exécute ma classe compagnie, j'ai des erreurs.

Quelqu'un peut il m'aider svp ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 package fr.rose.fr.CompagnieAerienne;
 
/**
  * La compagnie possède des avions et propose des vols aux clients.
 */
import java.util.ArrayList;
public class Compagnie
{
    //nom compagnie
    private String nom;
    //listes avion et vol
    public ArrayList avion;
    public ArrayList vol;
 
    public Compagnie(){}
    public Compagnie (String nom, ArrayList avion, ArrayList vol){ this.nom=nom;this.avion=avion;this.vol=vol;}
 
  //accesseurs
  public String getNom(){return nom;}
  public void setNom (String nom) {this.nom=nom;} 
 
    // méthode : ajouter des avions à la compagnie
        public void ajouter (ArrayList avion){ avion.add(avion);}
 
    // méthode : ouvrir des vols à la compagnie
    public void Ouvrir (ArrayList vol){vol.add(vol);}
 
    //Attacher un vol à un avion :
  public ArrayList<Avion> avions = new ArrayList<Avion>();
  void Assigner_Avion(Vol vol, Avion avion)
{
avions.add(avion);
vol.avion = avion;
}  
 
 //chercher le numéro de vol suivant les lieux de départ et destination :
int numvol(String depart, String arrivee) 
{
       for (int i = 0 ; i < vol.size() ; i++)
{
    vol=vol[]
    if (vol.depart == origin && vol.arrivee == destination)
       return vol.volnum;
}
return -1;
}
 
//enregistrement des données compagnie sur le disque :
   public void toDisque()
  {
    try {
      FileOutputStream fichier = new FileOutputStream("compagnie.data");
      ObjectOutputStream oos = new ObjectOutputStream(fichier);
      oos.writeObject(this);
      oos.flush();
      oos.close();
    }
    catch (java.io.IOException e) {
      e.printStackTrace();
    }
  }
  }

Le début de ma classe Vol :


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
public class Vol extends Compagnie
{
 
        private int numvol;
        private String depart;
        private String arrivee;
        private float tarifPremClasse;
        private float tarifClassEco;
        public Avion avion;
...
}

J'obtiens une erreur dans ma classe Compagnie à la ligne 42 : "Class Expected"

Merci d'avance pour votre aide,
Rose