0

I'm working on a school project with the purpose to create a program to manage and organize an event. I have several classes that all work fine and don't have any errors. Unfortunately this is not the case for my EventUI.java :

Fixed all the errors I could solve but I don't understand the remaining 3 errors:

*

Compiliere EventUI.java mit Java-Compiler
EventUI.java:27:6: error: cannot find symbol
    e.addCrewListe("Max  ",1);
     ^
  symbol:   method addCrewListe(String,int)
  location: variable e of type Event
EventUI.java:31:6: error: cannot find symbol
    e.addVeranstalterListe("Gruppe 1");
     ^
  symbol:   method addVeranstalterListe(String)
  location: variable e of type Event
EventUI.java:35:6: error: cannot find symbol
    e.addVipListe("Lara  ",1);
     ^
  symbol:   method addVipListe(String,int)
  location: variable e of type Event
3 errors

*

Any idea how to solve this? Or does anyone know a possible solution for this? Thank you!

Here's the EventUI.java:

/**
 *
 * Beschreibung
 *
 * @version 1.0 vom 11.03.2020
 * @author 
 */
 import static java.lang.System.*;
 import java.util.Scanner;


public class EventUI {

  public static void main(String[] args) {
    Event e = new Event();

    //System.out.println(e.zeigeArtistListe());
    //Hinzufügen von Artists
    e.addArtist("Eminem  ",1);

    //System.out.println(e.zeigeBesucherListe());
    //Hinzufügen von Besuchern
    e.addBesucher("Eniss D.  ",1);

    //System.out.println(e.zeigeCrewListe());
    //Hinzufügen von Crewmitgliedern
    e.addCrewListe("Max  ",1);

    //System.out.println(e.zeigeVeranstalterListe());
    //Hinzufügen von Veranstaltern
    e.addVeranstalterListe("Gruppe 1");

    //System.out.println(e.zeigeVipListe());
    //Hinzufügen von VIP's
    e.addVipListe("Lara  ",1);


    //Anzeige
    System.out.println(e.zeigeArtistListe() );  
    System.out.println(e.zeigeBesucherListe() );
    System.out.println(e.zeigeCrewListe() );
    System.out.println(e.zeigeVeranstalterListe() );
    System.out.println(e.zeigeVipListe() );

  } 





} // end of EventUI

And here is the Event Class:

/**
  *
  * Beschreibung
  *
  * @version 1.0 vom 26.02.2020
  * @author 
  */
import java.util.ArrayList;
import java.io.*; 
import static java.lang.System.*;
public class Event {

  // Anfang Attribute
  private String nameVeranstalter;      
  //ArrayList 
  private ArrayList<Artist> ArtistListe;  
  private ArrayList<Besucher> BesucherListe;
  private ArrayList<Crew> CrewListe;
  private ArrayList<Veranstalter> VeranstalterListe;
  private ArrayList<Vip> VipListe;

  //Anfang Methoden
  public Event(){
   ArtistListe = new ArrayList<Artist>();  
   BesucherListe = new ArrayList<Besucher>();
   CrewListe = new ArrayList<Crew>();
   VeranstalterListe = new ArrayList<Veranstalter>();
   VipListe = new ArrayList<Vip>();   
  }
  public ArrayList<Artist> getArtistListe(){
    return ArtistListe;
  }
  public ArrayList<Besucher> getBesucherListe(){
    return BesucherListe;
  }
  public ArrayList<Crew> getCrewListe(){
    return CrewListe;
  }
  public ArrayList<Veranstalter> getVeranstalterListe(){
    return VeranstalterListe;
  }
  public ArrayList<Vip> getVipListe(){
    return VipListe;
  }

  //Hinzufügen
  public void addArtist(String name, int artistId){       
  ArtistListe.add(new Artist(name, artistId));
  }
  public void addBesucher(String bes, int besucherId){
  BesucherListe.add(new Besucher(bes, besucherId ));
  }  
  public void addCrew(String name, int crewId ){
  CrewListe.add(new Crew(name, crewId ));
  }   
  public void addVeranstalter(String name){
  VeranstalterListe.add(new Veranstalter(name));
  }   
  public void addVip(String name, int vipId ){
  VipListe.add(new Vip(name, vipId ));
  }

  //Zeige Inhalt Nach Gruppen bzw Klassen
  public String zeigeArtistListe() {
    String ergebnis = "";
    for(Artist a : ArtistListe) {
      ergebnis += a.toString() + "\n";
    }
    if( ergebnis.equals("")){
      ergebnis = "Keine Künstler da.";
    }
    return ergebnis;
  }

  public String zeigeBesucherListe() {
    String ergebnis = "";
    for(Besucher b : BesucherListe) {
      ergebnis += b.toString() + "\n";
    }
    if( ergebnis.equals("")){
      ergebnis = "Keine Besucher da.";
    }
    return ergebnis;
  }

  public String zeigeCrewListe() {
    String ergebnis = "";
    for(Crew c : CrewListe) {
      ergebnis += c.toString() + "\n";
    }
    if( ergebnis.equals("")){
      ergebnis = "Die Crew ist nicht anwesend.";
    }
    return ergebnis;
  }          
  public String zeigeVeranstalterListe() {
    String ergebnis = "";
    for(Veranstalter v : VeranstalterListe) {
      ergebnis += v.toString() + "\n";
    }
    if( ergebnis.equals("")){
      ergebnis = "Die Veranstalter sind nicht da.";
    }
    return ergebnis;
  }  
  public String zeigeVipListe() {
    String ergebnis = "";
    for(Vip vp : VipListe) {
      ergebnis += vp.toString() + "\n";
    }
    if( ergebnis.equals("")){
      ergebnis = "Kein VIP anwesend.";
    }
    return ergebnis;
  }  

  // Ende Methoden
} // end of Event
cnunn
  • 11
  • 3
  • 2
    Can you post the Event class - I'm guessing that you are calling a method with the wrong type or number of parameters - or the method is private. – pczeus Apr 04 '20 at 20:56
  • alright. will add the event class too – cnunn Apr 04 '20 at 21:04

3 Answers3

0

In your EventUI class, you call several e.add<something>Liste()', but these methods don't exist on theEventclass. Instead you should call thee.add()` methods, with corrections shown below for the EventUI class:

/**
 *
 * Beschreibung
 *
 * @version 1.0 vom 11.03.2020
 * @author 
 */
 import static java.lang.System.*;
 import java.util.Scanner;


public class EventUI {

  public static void main(String[] args) {
    Event e = new Event();

    //System.out.println(e.zeigeArtistListe());
    //Hinzufügen von Artists
    e.addArtist("Eminem  ",1);

    //System.out.println(e.zeigeBesucherListe());
    //Hinzufügen von Besuchern
    e.addBesucher("Eniss D.  ",1);

    //System.out.println(e.zeigeCrewListe());
    //Hinzufügen von Crewmitgliedern
    e.addCrew("Max  ",1); //CORRECTED

    //System.out.println(e.zeigeVeranstalterListe());
    //Hinzufügen von Veranstaltern
    e.addVeranstalter("Gruppe 1"); //CORRECTED

    //System.out.println(e.zeigeVipListe());
    //Hinzufügen von VIP's
    e.addVip("Lara  ",1); //CORRECTED


    //Anzeige
    System.out.println(e.zeigeArtistListe() );  
    System.out.println(e.zeigeBesucherListe() );
    System.out.println(e.zeigeCrewListe() );
    System.out.println(e.zeigeVeranstalterListe() );
    System.out.println(e.zeigeVipListe() );

  } 
} 

Basically, the errors were indicating that you were trying to call methods on the Event class that do not exist.

pczeus
  • 7,709
  • 4
  • 36
  • 51
  • 1
    Hello, thank you very much for your fast support! This was the fix to the problem and the application is running now! – cnunn Apr 05 '20 at 12:13
0

If you got that class from somewhere else, you also need to pick other related classes. You are having an import error because the java compiler could not find some of the classes/methods you're trying to call

  • yeah just havent uploaded the other classes to here since there was no error with them. – cnunn Apr 05 '20 at 01:16
0
import static java.lang.System.*;
import java.util.Scanner;

public class EventUI {

  public static void main(String[] args) {
    Event e = new Event();

    //System.out.println(e.zeigeArtistListe());
    //Hinzufügen von Artists
    e.addArtist("Eminem  ",1);

    //System.out.println(e.zeigeBesucherListe());
    //Hinzufügen von Besuchern
    e.addBesucher("Eniss D.  ",1);

    //System.out.println(e.zeigeCrewListe());
    //Hinzufügen von Crewmitgliedern
    e.addCrew("Max  ",1); //CORRECTED

    //System.out.println(e.zeigeVeranstalterListe());
    //Hinzufügen von Veranstaltern
    e.addVeranstalter("Gruppe 1"); //CORRECTED

    //System.out.println(e.zeigeVipListe());
    //Hinzufügen von VIP's
    e.addVip("Lara  ",1); //CORRECTED

    //Anzeige
    System.out.println(e.zeigeArtistListe() );  
    System.out.println(e.zeigeBesucherListe() );
    System.out.println(e.zeigeCrewListe() );
    System.out.println(e.zeigeVeranstalterListe() );
    System.out.println(e.zeigeVipListe() );
  } 
} 
סטנלי גרונן
  • 2,917
  • 23
  • 46
  • 68
swapnil
  • 1
  • 1