From e8a5a507dfd85ef5696a8287f3c403cc66ce7a01 Mon Sep 17 00:00:00 2001 From: alpina0707 Date: Wed, 9 Feb 2022 19:32:21 +0100 Subject: [PATCH] productive for quieter() if volume is zero --- src/main/java/device/radioPlayer/RadioPlayer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/device/radioPlayer/RadioPlayer.java b/src/main/java/device/radioPlayer/RadioPlayer.java index 5c051b8..ca8897d 100644 --- a/src/main/java/device/radioPlayer/RadioPlayer.java +++ b/src/main/java/device/radioPlayer/RadioPlayer.java @@ -29,14 +29,14 @@ public class RadioPlayer implements Device { @Override public void louder() { - if(Lautstaerke < 100){ - Lautstaerke+=1;} + if(Lautstaerke < 100){Lautstaerke+=1;} else Lautstaerke = 100; } @Override public void quieter() { - Lautstaerke-=1; + if(Lautstaerke > 0){Lautstaerke-=1;} + else Lautstaerke = 0; } @Override public int getVolume() {