Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Gerichte {
- private double preis;
- private static int anzahlVerkauft = 0;
- public Gerichte(double preis) {
- this.preis = preis;
- anzahlVerkauft++;
- }
- public static int getGesamtAnzahl() {
- return anzahlVerkauft;
- }
- public double getPreis() {
- return preis;
- }
- }
- public class Hauptgericht extends Gerichte {
- private static int anzahlVerkauft = 0;
- public Hauptgericht() {
- super(2.90);
- anzahlVerkauft++;
- }
- public static int getAnzahl() {
- return anzahlVerkauft;
- }
- }
- public class Nachtisch extends Gerichte {
- private static int anzahlVerkauft = 0;
- public Nachtisch() {
- super(0.60);
- anzahlVerkauft++;
- }
- public static int getAnzahl() {
- return anzahlVerkauft;
- }
- }
- public class Salat extends Gerichte {
- private static int anzahlVerkauft = 0;
- public Salat(double gewicht) {
- super((gewicht / 100 * 0.3));
- anzahlVerkauft++;
- }
- public static int getAnzahl() {
- return anzahlVerkauft;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement