funktioniert auch nicht mit &&
Wenn ich 0 für länge eingebe soll er mich nicht die breite abfragen
kompletter code:
[code=Java] public static void main(String[] args) {
int length;
int width;
int totalPrice=0;
do {
System.out.println("Nächster Teppich");
System.out.print("Länge: ");
length=In.readInt();
System.out.print("Breite: ");
width=In.readInt();
System.out.println();
totalPrice=totalPrice+carpetPrice(length,width);
if((length==0) || (width==0)){
System.out.println("Preis: "+totalPrice);
break;
}
} while((length!=0) && (width!=0));
}
static int carpetPrice(int length, int width) {
int priceQMeter;
if ((length == 1) || (width == 1)){
priceQMeter = 15;
} else {
priceQMeter = 10;
}
return length * width * priceQMeter;
}
}[/code]