Hallo zusammen,
ich bekomme eine Fehlermeldung : "the static method rest should be accessed is a static way".
Bitte um Hilfe, bin noch ein totaler Anfänger
ich bekomme eine Fehlermeldung : "the static method rest should be accessed is a static way".
Bitte um Hilfe, bin noch ein totaler Anfänger
Java:
public class Essen {
static int stueck;
static double preis;
static int geld = 10;
Essen(int Stueck, double Preis){
stueck= Stueck;
preis=Preis;
}
public static double summe(int stueck, double preis) {
return stueck * preis;
}
public static double rest(int geld, double summe) {
return geld - summe(stueck, preis);
}
public static void main(String[] args) {
Essen wurst = new Essen(1, 3.99);
Essen ei = new Essen (3, 5.45);
System.out.println(rest(geld, summe(stueck, preis)));
}
}