From b353c2b12c57aacd7b3303ceaefcb02d793a6990 Mon Sep 17 00:00:00 2001 From: SteffenLm <33038091+SteffenLm@users.noreply.github.com> Date: Sun, 8 Oct 2023 00:11:20 +0200 Subject: [PATCH 1/2] Implement Solution --- Exercise.java | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Exercise.java b/Exercise.java index 3c092f9..19d0980 100644 --- a/Exercise.java +++ b/Exercise.java @@ -1,6 +1,34 @@ +import java.util.Scanner; + public class Exercise { public static void main(String[] args) { - // implement exercise here + + Scanner scanner = new Scanner(System.in); + + int k; + double p; + + boolean loop; + do { + System.out.print("Gib bitte das Startkapital ein (in Euro): "); + k = scanner.nextInt(); + + System.out.print("Gib bitte den Prozentsatz ein: "); + p = scanner.nextDouble(); + + System.out.println( + "Ergebnis: Der Jahreszins betraegt " + (int) calculateInterestPerAnnum(k, p) + " Euro"); + + System.out.print("Willst Du einen weiteren Jahreszins berechnen (true, false)?: "); + loop = scanner.nextBoolean(); + } while (loop); + + scanner.close(); + + } + + static double calculateInterestPerAnnum(int k, double p) { + return k * p / 100; } } From 66ea730b769b3c1f17b70ead83cd20da40956708 Mon Sep 17 00:00:00 2001 From: github-actions <> Date: Sat, 7 Oct 2023 22:12:03 +0000 Subject: [PATCH 2/2] Google Java Format --- Exercise.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Exercise.java b/Exercise.java index 19d0980..c436bc6 100644 --- a/Exercise.java +++ b/Exercise.java @@ -25,7 +25,6 @@ public static void main(String[] args) { } while (loop); scanner.close(); - } static double calculateInterestPerAnnum(int k, double p) {