From 57ca08e1fbdd84e91a7a31ef3ae8d7ba640976eb Mon Sep 17 00:00:00 2001 From: fdai7460 Date: Mon, 6 Feb 2023 18:50:46 +0100 Subject: [PATCH] Steuer 7% Berechner --- src/main/java/src/TasksFrame.java | 7 +++++++ src/test/java/src/TasksFrameTest.java | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/main/java/src/TasksFrame.java b/src/main/java/src/TasksFrame.java index bf0effa..863e515 100644 --- a/src/main/java/src/TasksFrame.java +++ b/src/main/java/src/TasksFrame.java @@ -247,6 +247,13 @@ public class TasksFrame extends JFrame { return steuer; } + public double steuer7(double x) + { + double steuer=0; + steuer = (x * 0.07) / 1.07; + return steuer; + } + private void setupUmrechnen() { JPanel jPanel = setupPanel("Dezimal nach Binär"); diff --git a/src/test/java/src/TasksFrameTest.java b/src/test/java/src/TasksFrameTest.java index 51e8cc8..1fef532 100644 --- a/src/test/java/src/TasksFrameTest.java +++ b/src/test/java/src/TasksFrameTest.java @@ -49,6 +49,17 @@ class TasksFrameTest { assertEquals(0,x3,0.01); } + @Test + void setupSteuer7(){ + TasksFrame tasksFrame = new TasksFrame(); + double x = tasksFrame.steuer7(1190); + assertEquals(77.85,x, 0.01); + double x2 = tasksFrame.steuer7(14); + assertEquals(0.92,x2,0.01); + double x3 = tasksFrame.steuer7(0); + assertEquals(0,x3,0.01); + } + @Test void setupDiff(){ TasksFrame frame = new TasksFrame();