j'ai pleins d'erreurs et je bloque avec le main si on peut m'aider
public class instruments {
String nom ;
String type ;
public instruments (String nom , String type ){
JOptionPane.showMessageDialog (null,"Bienvenue");
this.nom = nom ;
this.type = type ;
}
public boolean equals(instruments objet ){
boolean egalité ;
egalité= false ;
if (objet.type == this.type )
{ egalité = true ;
return egalité ;}
else
{ egalité = false ;
return false ;
}
}
public String toString(){
return ("le nom de l'instrument est :"+nom + "\n"+ "Il est de type:"+type);
}
}
class LotInstruments extends instruments{
int nbrInstr ;
public LotInstruments (int nbrInstr,String nom,String type) {
super (nom ,type);
this.nbrInstr = nbrInstr ;
}
public String toString(){ super.toString();
return ( "le nombre de lot:"+nbrInstr);
}
}
class Musicien {
String Nom ;
String Prenom;
ArrayList<String> LstInstr = new ArrayList<String>();
public Musicien (String Nom, String Prenom, ArrayList<String> LstInstr) {
public boolean joueTilDe (instruments instr){
boolean trouve;
trouve=false;
int i=0;
while ((i<this.LstInstr.size())&&(trouve=false)){
if (instr.nom==LstInstr.get(i))
trouve=true;
else{
trouve=false;
i++;
}
}
return (trouve);
}
public void addInstr (instruments instrum) {
for (int i=0; i<this.LstInstr.size();i++){
if (instrum.nom==LstInstr.get(i))
JOptionPane.showMessageDialog (null,"Ce musicien pratique deja cet instrument");
else {
LstInstr.add(instrum.nom);
}
}
}
public void rmInstr (instruments instrum){
for (int i=0; i<this.LstInstr.size();i++){
if (instrum.nom==LstInstr.get(i))
LstInstr.remove(i);
else {
JOptionPane.showMessageDialog (null,"cette instrument ne figure pas sur la liste de ce musicien");
}
}
}
public String toString(){
return ("L'artiste "+this.Nom+" fait du "+this.LstInstr);
}
}
class InstrumentSet {
HashSet<LotInstruments> InstrumentSet=new HashSet<LotInstruments>() ;
InstrumentSet (HashSet<LotInstruments> InstrumentSet){
this.InstrumentSet=InstrumentSet;
}
public LotInstruments searchInstr (String nom){
boolean p=false;
Iterator<LotInstruments> i=InstrumentSet.iterator(); // on crée un Iterator pour parcourir notre HashSet
while((i.hasNext())&&(p=false)) { // tant qu'on a un suivant
if (InstrumentSet.contains(nom)){
p=true;
}
}
if (p==true)
return (i.next());
else
return (null);
}
public void addInstr (LotInstruments newLotinstrument){
InstrumentSet.add(newLotinstrument);
}
public void rmInstr (LotInstruments lotinstrum){
InstrumentSet.remove(lotinstrum);
}
public void modifInstr (String nom, int b) {
Iterator<LotInstruments> i=InstrumentSet.iterator(); // on crée un Iterator pour parcourir notre HashSet
while (i.hasNext()) { // tant qu'on a un suivant
if (InstrumentSet.contains(nom))
i.next().nbrInst=b;
}
}
public String toString(){
return ("L'ensemble des intruments nécessaire a l'éxécution de l'oeuvre musicale est: "+ InstrumentSet);
}
}
public class OeuvreMusicale {
private String nomOeuvre;
private InstrumentSet instrSet;
private DataOutputStream donnée;
public OeuvreMusicale() {
this.instrSet= new InstrumentSet();
this.nomOeuvre="";
}
public class OrchestreSympho extends MusicienSet
{
public OrchestreSympho(MusicienSet orchestre) {
}
public OrchestreSympho(String nomMusicienSet, HashSet musiciens) {
if(musiciens.size()>50){
this.nomMusicienSet=nomMusicienSet;
this.musiciens=musiciens;}
else
System.out.println("OrchestreSympho doit comporter plus de 50 musiciens");
}
public OrchestreSympho() {
}
}
public class OrchestreCh extends MusicienSet{
public OrchestreCh(String nomMusicienSet,HashSet musiciens){
if(musiciens.size()>50){
this.nomMusicienSet=nomMusicienSet;
this.musiciens=musiciens;}
else
System.out.println("OrchestreSympho doit comporter plus de 50 musiciens");
}
public OrchestreCh() {
}
}
public class OrchesreJazz extends MusicienSet{
public OrchesreJazz(String nomMusicienSet,HashSet musiciens){
}
}
public class Concert(String titre , OeuvreMusicale oeuvre, HashSet musiciensOeuvre )
{
Le message qui suit est une réponse automatique.
Les réponses automatiques nous permettent d'éviter de répéter de nombreuses fois la même chose, et donc de gagner beaucoup de temps.
Nous sommes néanmoins ouvert à toute question ou remarque, n'hésite pas à me contacter par messagerie privée à ce sujet.
Merci d'utiliser les balises de code
Bonjour,
Les forums du Site du Zéro disposent d'une fonctionnalité permettant de colorer et mettre en forme les codes source.
Tu as posté un code source sans utiliser cette fonctionnalité. Pourrais-tu éditer ton message afin d'ajouter ces balises ? Pour cela, sélectionne ton code à colorer et utilise le bouton afin de choisir la coloration adaptée. Veille à bien choisir le langage de programmation afin que la coloration soit pertinente.
De plus, veille à ce que ton code soit correctement indenté.
Afin de ne pas surcharger le sujet, ne poste pas ton code coloré dans un nouveau message mais édite le premier (grâce au bouton ).
Cela aura pour effet de "colorer" ton code et donc d'en faciliter grandement la lecture. Tu auras ainsi beaucoup plus de chances d'avoir des réponses.
Voici un exemple de code non coloré (mauvais exemple) :
int main(int argc, char *argv[])
{
long choixOperation;
printf("Choisissez l'operation a effectuer");
/* etc. */
}
Voici maintenant le même code coloré, utilisant la balise "code" (bon exemple) :
int main(int argc, char *argv[])
{
long choixOperation;
printf("Choisissez l'operation a effectuer");
/* etc. */
}
× Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
× Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
Mon site perso / Retrouvez tous mes tutoriels vidéos à propos de Symfony2 sur Grafikart.fr