From f27deb2edd075df43338339451535c7d54866c9f Mon Sep 17 00:00:00 2001 From: SteffenLm <33038091+SteffenLm@users.noreply.github.com> Date: Mon, 24 Oct 2022 11:46:28 +0200 Subject: [PATCH 1/4] implement solution --- Exercise.java | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Exercise.java b/Exercise.java index 3c092f9..12f9bf9 100644 --- a/Exercise.java +++ b/Exercise.java @@ -1,6 +1,32 @@ +import java.util.Scanner; + public class Exercise { public static void main(String[] args) { - // implement exercise here + + @SuppressWarnings("resource") + 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); + } + + static double calculateInterestPerAnnum(int k, double p) { + return k * p / 100; + } } From 87589c6ff9d043669641a3ffb2f734b42a68fed9 Mon Sep 17 00:00:00 2001 From: github-actions <> Date: Mon, 24 Oct 2022 09:46:46 +0000 Subject: [PATCH 2/4] Google Java Format --- Exercise.java | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Exercise.java b/Exercise.java index 12f9bf9..8f54049 100644 --- a/Exercise.java +++ b/Exercise.java @@ -4,29 +4,29 @@ public class Exercise { public static void main(String[] args) { - @SuppressWarnings("resource") - Scanner scanner = new Scanner(System.in); + @SuppressWarnings("resource") + Scanner scanner = new Scanner(System.in); - int k; - double p; + int k; + double p; - boolean loop; - do { - System.out.print("Gib bitte das Startkapital ein (in Euro): "); - k = scanner.nextInt(); + 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.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); + 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); } - static double calculateInterestPerAnnum(int k, double p) { - return k * p / 100; - } + static double calculateInterestPerAnnum(int k, double p) { + return k * p / 100; + } } From ea830ccaa365e1f443a74dfde6f385d718c6731f Mon Sep 17 00:00:00 2001 From: SteffenLm <33038091+SteffenLm@users.noreply.github.com> Date: Mon, 24 Oct 2022 11:51:17 +0200 Subject: [PATCH 3/4] remove line --- Exercise.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Exercise.java b/Exercise.java index 8f54049..76f195d 100644 --- a/Exercise.java +++ b/Exercise.java @@ -3,7 +3,6 @@ public class Exercise { public static void main(String[] args) { - @SuppressWarnings("resource") Scanner scanner = new Scanner(System.in); From 685a7697ec563a2e5e20e2870a09022d5d1b87a9 Mon Sep 17 00:00:00 2001 From: SteffenLm <33038091+SteffenLm@users.noreply.github.com> Date: Fri, 19 Dec 2025 20:58:18 +0000 Subject: [PATCH 4/4] add dev container --- .devcontainer.json | 3 +++ .vscode/extensions.json | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 .devcontainer.json create mode 100644 .vscode/extensions.json diff --git a/.devcontainer.json b/.devcontainer.json new file mode 100644 index 0000000..bfbeb0d --- /dev/null +++ b/.devcontainer.json @@ -0,0 +1,3 @@ +{ + "image": "mcr.microsoft.com/devcontainers/java:21" +} \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..add4f4e --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "vscjava.vscode-java-pack" + ] +} \ No newline at end of file