package de.tankstelle;
-import java.util.HashMap;
-
public class GrosseTankstelle extends Tankstelle {
private String betreiberfirma_supermarkt;
- public GrosseTankstelle(String betreiberfirma_supermarkt, byte mitarbeiterzahl, HashMap<Treibstofftyp, Treibstoff> treibstoffe) {
- super(mitarbeiterzahl, treibstoffe);
+ public GrosseTankstelle(String betreiberfirma_supermarkt) {
+ Treibstoff[] treibstoffe = { new Treibstoff(Treibstofftyp.SUPER, 16000f, 0f),
+ new Treibstoff(Treibstofftyp.SUPER_E10, 16000f, 0f),
+ new Treibstoff(Treibstofftyp.DIESEL, 16000f, 0f),
+ new Treibstoff(Treibstofftyp.PREMIUM_DIESEL, 16000f, 0f),
+ new Treibstoff(Treibstofftyp.AUTOGAS, 16000f, 0f) };
+ super((byte) 4, treibstoffe);
+
this.betreiberfirma_supermarkt = betreiberfirma_supermarkt;
}
}
package de.tankstelle;
-import java.util.HashMap;
-
public class KleineTankstelle extends Tankstelle {
private short anzahl_getraenkeautomaten;
- public KleineTankstelle(short anzahl_getraenkeautomaten, byte mitarbeiterzahl, HashMap<Treibstofftyp, Treibstoff> treibstoffe) {
- super(mitarbeiterzahl, treibstoffe);
+ public KleineTankstelle(short anzahl_getraenkeautomaten) {
+ Treibstoff[] treibstoffe = { new Treibstoff(Treibstofftyp.SUPER, 8000f, 0f),
+ new Treibstoff(Treibstofftyp.DIESEL, 8000f, 0f) };
+ super((byte) 4, treibstoffe);
this.anzahl_getraenkeautomaten = anzahl_getraenkeautomaten;
}
}
package de.tankstelle;
-import java.util.HashMap;
-
public class MittlereTankstelle extends Tankstelle {
private short quadratmeterzahl_verkaufsflaeche;
- public MittlereTankstelle(short quadratmeterzahl_verkaufsflaeche, byte mitarbeiterzahl, HashMap<Treibstofftyp, Treibstoff> treibstoffe) {
- super(mitarbeiterzahl, treibstoffe);
+ public MittlereTankstelle(short quadratmeterzahl_verkaufsflaeche) {
+ Treibstoff[] treibstoffe = { new Treibstoff(Treibstofftyp.SUPER, 12000f, 0f),
+ new Treibstoff(Treibstofftyp.SUPER_E10, 12000f, 0f),
+ new Treibstoff(Treibstofftyp.PREMIUM_DIESEL, 12000f, 0f),
+ new Treibstoff(Treibstofftyp.AUTOGAS, 12000f, 0f) };
+ super((byte) 4, treibstoffe);
this.quadratmeterzahl_verkaufsflaeche = quadratmeterzahl_verkaufsflaeche;
}
}
package de.tankstelle;
-import java.util.HashMap;
-
public class Tankstelle {
/**
* Anzahl der Mitarbeiter einer Tankstelle
* Treibstoffarten und -mengen. Array als Datentyp u.U. nicht geeignet ->
* Alternative suchen (HashMap)
*/
- HashMap<Treibstofftyp, Treibstoff> treibstoffe;
+ Treibstoff[] treibstoffe;
/**
* Superconstructor. Nur sichtbar für hiervon erbende Klassen
* @param mitarbeiterzahl
* @param treibstoffe
*/
- protected Tankstelle(byte mitarbeiterzahl, HashMap<Treibstofftyp, Treibstoff> treibstoffe) {
+ protected Tankstelle(byte mitarbeiterzahl, Treibstoff[] treibstoffe) {
this.mitarbeiterzahl = mitarbeiterzahl;
this.treibstoffe = treibstoffe;
}
package de.tankstelle;
public class Treibstoff {
+ /**
+ * Der Treibstofftyp. Wird sich innerhalb einer Instanz nicht ändern und ist deshalb final
+ */
+ public final Treibstofftyp TREIBSTOFFTYP;
+
/**
* Vorhandener Treibstoffvorrat
*/
*/
public float preis;
- Treibstoff(float menge, float preis) {
+ Treibstoff(Treibstofftyp Treibstofftyp, float menge, float preis) {
+ this.TREIBSTOFFTYP = Treibstofftyp;
this.menge = menge;
this.preis = preis;
}