Guten Abend Community,
nachdem ich hier schon ein bisschen herumgestöbert hatte, möchte ich mich auch mal zu Wort melden.
Ich habe ein Problem bei einem Programm, dass wir zwecks Studium erstellen sollen.
Habe dieses jetzt fertig, und die Ausgabe stimmt auch.
Jedoch sagt mir der Testserver, dass kein korrekter Schleifendurchlauf beim Durchlaufen des Standort Arrays stattfindet in den Methoden gesamteFlaeche(), istvertretenin() und im Konstruktor der Klasse Aussteller.
Wie gesagt, ich sehe keinen Fehler und die Ausgabe ist korrekt.
Seht bitte selbst:
Hier nochmal die Ausgabe:
Hier nochmal die Beanstandung des Testservers:
Würde mich freuen, wenn mir jemand bestätigen würde, dass der Testserver spinnt (eigentlich unwarscheinlich) oder ob ich doch noch irgend einen kleinen Fehler drin habe!
Schönen Abend noch,
Philipp von der Wirtschaftsinformatik Essen.
nachdem ich hier schon ein bisschen herumgestöbert hatte, möchte ich mich auch mal zu Wort melden.
Ich habe ein Problem bei einem Programm, dass wir zwecks Studium erstellen sollen.
Habe dieses jetzt fertig, und die Ausgabe stimmt auch.
Jedoch sagt mir der Testserver, dass kein korrekter Schleifendurchlauf beim Durchlaufen des Standort Arrays stattfindet in den Methoden gesamteFlaeche(), istvertretenin() und im Konstruktor der Klasse Aussteller.
Wie gesagt, ich sehe keinen Fehler und die Ausgabe ist korrekt.
Seht bitte selbst:
Code:
public class Messe {
public Aussteller[] aussteller;
public int Grundpreis = 200;
public int AnmeldeBeitrag = 300;
public Messe(int max){
aussteller = new Aussteller[max];
}
public static void main(String args[])
{
int max = 12 ;
Messe m = new Messe(max);
Standort [] standort1 = { new Standort("Halle1", "A1","Auto ID/ RFID", 100),
new Standort("Halle2", "B25","Transport & Logistic", 65),
new Standort("Halle4", "A13","Telematics & Navigation", 30)};
m.neuerAusstellerEinfuegen("S-Software & Logistic", standort1, false);
Standort [] standort2 = { new Standort("Halle1", "C22","Business Communication", 200),
new Standort("Halle1", "A22","Business Intelligence", 50),
new Standort("Halle1", "C10","Security World", 38),
new Standort("Halle2", "C20","Banking & Finance World", 70),
new Standort("Halle2", "D3","Internet & Mobile Solutions", 45),
new Standort("Halle4", "B15","Virtualization, Business storage", 40) };
m.neuerAusstellerEinfuegen("IBN", standort2, true);
Standort [] standort3 = { new Standort("Halle1", "A10","Auto ID/RFID", 120),
new Standort("Halle1", "C11","Security World", 30),
new Standort("Halle2", "B4","Transport & Logistic", 80),
new Standort("Halle2", "E2","eHealth & Telehealth", 70),
new Standort("Halle2", "D7","Internet & Mobile Solutions", 55),
new Standort("Halle3", "B10","Enterprise Applications", 46),
new Standort("Halle3", "B27","Software & System Management", 52),
new Standort("Halle3", "B10","Customer Relationship Management", 20),
new Standort("Halle4", "A10","Telematics & Navigation", 36)
};
m.neuerAusstellerEinfuegen("Siennes", standort3, true);
Standort [] standort4 = { new Standort("Halle1", "D2","Learning & Knowledg Solutions", 70),
new Standort("Halle2", "D2","Internet & Mobile Solution", 60),
new Standort("Halle3", "B11","Customer Relationship Management", 40),
new Standort("Halle3", "C3","Document Management Solutions", 55),
new Standort("Halle4", "B13","Virtualization, Business storage", 22) };
m.neuerAusstellerEinfuegen("Acoba", standort4, false);
Standort [] standort5 = { new Standort("Halle1", "A24","Business Intelligence", 25),
new Standort("Halle3", "D2","Enterprise Content Management", 30),
new Standort("Halle3", "B11","Enterprise Solutions", 20) };
m.neuerAusstellerEinfuegen("Syraxon", standort5, true);
Standort[] standort6 = { new Standort("Halle2", "C24","Banking & Finance World", 30)};
m.neuerAusstellerEinfuegen("eMoney.com", standort6, false);
Standort[] standort7 = { new Standort("Halle3", "B23","Software & System Management", 45)};
m.neuerAusstellerEinfuegen("DeraSoft", standort7, false);
Standort[] standort8 = { new Standort("Halle4", "C16","Unified Communication", 35)};
m.neuerAusstellerEinfuegen("AlphaCom", standort8, false);
m.ausgabe();
System.out.println(m.aussteller[0].ist_vertreten_in("Learning & Knowledg Solutions"));
System.out.println(m.aussteller[1].ist_vertreten_in("Internet & Mobile Solutions"));
}
public void ausgabe()
{
int i = 0;
System.out.println
("+------------------------------Aussteller------------------------------+");
while(aussteller[i] != null)
{
System.out.println((i+1)+". "+aussteller[i].liesName()+
" ID: "+aussteller[i].liesID()+" Kosten "+aussteller[i].liesStandKosten()+" Euro");
System.out.println("\n+--Standorte und Branche--+ ");
for(int j= 0; j < aussteller[i].AnzahlStandorte(); j++)
{
System.out.println(" Standort"+(j+1)+": "+
aussteller[i].liesStandorte()[j].holeStandort()+" Branche: "+
aussteller[i].liesStandorte()[j].holeBranche());
}
System.out.println();
i++;
}
}
public void neuerAusstellerEinfuegen(String Name, Standort[] standorte, boolean fruebucher )
{
int i = 0;
while (aussteller[i] != null) {
i++;
}
aussteller[i] = new Aussteller(i+1 , Name, standorte, fruebucher);
aussteller[i].berechneKosten(Grundpreis, AnmeldeBeitrag);
}
}
Code:
public class Aussteller {
private int ID;
private String Name;
private Standort[] Standorte;
private boolean fruebucher;
private double Standkosten;
public Aussteller(int ID, String Name, Standort [] stand, boolean fruebucher)
{
this.ID = ID;
this.Name = Name;
this.fruebucher = fruebucher;
Standorte = new Standort[stand.length];
for (int i = 0; i < Standorte.length; i++) {
Standorte[i] = stand[i];
}
this.Standkosten = 0;
}
public int liesID() {
return this.ID;
}
public String liesName() {
return this.Name;
}
public int AnzahlStandorte() {
return Standorte.length;
}
public double liesStandKosten() {
return this.Standkosten;
}
public Standort [] liesStandorte() {
return this.Standorte;
}
public int gesamtFlaeche()
{
int summe = 0;
for (int i = 0; i < Standorte.length; i++) {
summe += Standorte[i].holeFlaeche();
}
return summe;
}
public void berechneKosten(int Grundpreis, int AnmeldeBeitrag)
{
double neuerGrundPreis = 0;
if (fruebucher && gesamtFlaeche() >250) {
neuerGrundPreis = Grundpreis - (Grundpreis * 0.035);
neuerGrundPreis = neuerGrundPreis - (neuerGrundPreis * 0.05);
}
else if (fruebucher && gesamtFlaeche() <= 250) {
neuerGrundPreis = Grundpreis - (Grundpreis * 0.035);
}
else if (!fruebucher && gesamtFlaeche() > 250) {
neuerGrundPreis = Grundpreis - (Grundpreis * 0.05);
}
else neuerGrundPreis = Grundpreis;
Standkosten = neuerGrundPreis * gesamtFlaeche() + AnmeldeBeitrag;
}
public boolean ist_vertreten_in( String Branche)
{
boolean check = false;
for (int i = 0; i < Standorte.length; i++) {
if (Standorte[i].holeBranche().equals(Branche))
check = true;
}
return check;
}
}
Code:
public class Standort {
private String Halle;
private String PlatzBez;
private String Branche;
private int Flaeche;
Standort( String Halle, String PlatzBez, String Branche, int Flaeche)
{
this.Halle = Halle;
this.PlatzBez = PlatzBez;
this.Branche = Branche;
this.Flaeche = Flaeche;
}
public int holeFlaeche() {
return this.Flaeche;
}
public String holeStandort() {
return this.Halle + this.PlatzBez;
}
public String holeBranche() {
return this.Branche;
}
}
Hier nochmal die Ausgabe:
+------------------------------Aussteller------------------------------+
1. S-Software & Logistic ID: 1 Kosten 39300.0 Euro
+--Standorte und Branche--+
Standort1: Halle1A1 Branche: Auto ID/ RFID
Standort2: Halle2B25 Branche: Transport & Logistic
Standort3: Halle4A13 Branche: Telematics & Navigation
2. IBN ID: 2 Kosten 81524.05 Euro
+--Standorte und Branche--+
Standort1: Halle1C22 Branche: Business Communication
Standort2: Halle1A22 Branche: Business Intelligence
Standort3: Halle1C10 Branche: Security World
Standort4: Halle2C20 Branche: Banking & Finance World
Standort5: Halle2D3 Branche: Internet & Mobile Solutions
Standort6: Halle4B15 Branche: Virtualization, Business storage
3. Siennes ID: 3 Kosten 93625.15 Euro
+--Standorte und Branche--+
Standort1: Halle1A10 Branche: Auto ID/RFID
Standort2: Halle1C11 Branche: Security World
Standort3: Halle2B4 Branche: Transport & Logistic
Standort4: Halle2E2 Branche: eHealth & Telehealth
Standort5: Halle2D7 Branche: Internet & Mobile Solutions
Standort6: Halle3B10 Branche: Enterprise Applications
Standort7: Halle3B27 Branche: Software & System Management
Standort8: Halle3B10 Branche: Customer Relationship Management
Standort9: Halle4A10 Branche: Telematics & Navigation
4. Acoba ID: 4 Kosten 49700.0 Euro
+--Standorte und Branche--+
Standort1: Halle1D2 Branche: Learning & Knowledg Solutions
Standort2: Halle2D2 Branche: Internet & Mobile Solution
Standort3: Halle3B11 Branche: Customer Relationship Management
Standort4: Halle3C3 Branche: Document Management Solutions
Standort5: Halle4B13 Branche: Virtualization, Business storage
5. Syraxon ID: 5 Kosten 14775.0 Euro
+--Standorte und Branche--+
Standort1: Halle1A24 Branche: Business Intelligence
Standort2: Halle3D2 Branche: Enterprise Content Management
Standort3: Halle3B11 Branche: Enterprise Solutions
6. eMoney.com ID: 6 Kosten 6300.0 Euro
+--Standorte und Branche--+
Standort1: Halle2C24 Branche: Banking & Finance World
7. DeraSoft ID: 7 Kosten 9300.0 Euro
+--Standorte und Branche--+
Standort1: Halle3B23 Branche: Software & System Management
8. AlphaCom ID: 8 Kosten 7300.0 Euro
+--Standorte und Branche--+
Standort1: Halle4C16 Branche: Unified Communication
false
true
Hier nochmal die Beanstandung des Testservers:
Klasse 'Aussteller', Methode 'gesamtFlaeche()'
Es findet kein korrekter Schleifendurchlauf statt, um das Array der Standorte zu durchlaufen.
Klasse 'Aussteller', Methode 'ist_vertreten_in()'
Es findet kein korrekter Schleifendurchlauf statt, um das Array der Standorte zu durchlaufen.
Konstruktor der Klasse 'Aussteller'
Es findet kein korrekter Schleifendurchlauf statt, um das Array der Standorte zu kopieren.
Würde mich freuen, wenn mir jemand bestätigen würde, dass der Testserver spinnt (eigentlich unwarscheinlich) oder ob ich doch noch irgend einen kleinen Fehler drin habe!
Schönen Abend noch,
Philipp von der Wirtschaftsinformatik Essen.
Zuletzt bearbeitet: