From 4e47dec09b9dcac2594d70a6ed8eb97a0ebc4482 Mon Sep 17 00:00:00 2001 From: sahar Date: Mon, 31 Jan 2022 21:56:01 +0100 Subject: [PATCH] implement the set and get of the Lautstaerke in the UsbPlayer class --- src/main/java/device/UsbPlayer.java | 10 ++++++++++ src/test/java/device/UsbPlayerTest.java | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/main/java/device/UsbPlayer.java b/src/main/java/device/UsbPlayer.java index 5def7ab..827e486 100644 --- a/src/main/java/device/UsbPlayer.java +++ b/src/main/java/device/UsbPlayer.java @@ -2,6 +2,16 @@ package device; public class UsbPlayer implements Device{ + private int Lautstaerke=0; + + public void setLautstaerke(int ls){ + if(Lautstaerke < 100) { + Lautstaerke += 1; + } else { + Lautstaerke = 100; + } } + public int getLautstaerke(){return Lautstaerke;} + @Override public void louder() { diff --git a/src/test/java/device/UsbPlayerTest.java b/src/test/java/device/UsbPlayerTest.java index a638c8a..49b2ed2 100644 --- a/src/test/java/device/UsbPlayerTest.java +++ b/src/test/java/device/UsbPlayerTest.java @@ -6,6 +6,8 @@ import static org.junit.jupiter.api.Assertions.*; class UsbPlayerTest { + UsbPlayer up =new UsbPlayer(); + /* @Test void louder() {