From ad40aef245322b4e741cb32be71862661eea44bd Mon Sep 17 00:00:00 2001 From: Matti Date: Wed, 10 Apr 2024 12:16:25 +0200 Subject: [PATCH] Aufgabe 1-3 --- src/Main.java | 2 +- src/part3/aufg1.java | 7 +++++++ src/part3/aufg2.java | 23 +++++++++++++++++++++++ src/part3/aufg3.java | 13 +++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/part3/aufg1.java create mode 100644 src/part3/aufg2.java create mode 100644 src/part3/aufg3.java diff --git a/src/Main.java b/src/Main.java index 148a9e8..47f9e0b 100644 --- a/src/Main.java +++ b/src/Main.java @@ -4,7 +4,7 @@ public class Main { public static void main(String[] args) { // Press Alt+Eingabe with your caret at the highlighted text to see how // IntelliJ IDEA suggests fixing it. - System.out.printf("Hello and welcome!"); + System.out.println("Hello and welcome!"); // Press Umschalt+F10 or click the green arrow button in the gutter to run the code. for (int i = 1; i <= 5; i++) { diff --git a/src/part3/aufg1.java b/src/part3/aufg1.java new file mode 100644 index 0000000..b50a6e3 --- /dev/null +++ b/src/part3/aufg1.java @@ -0,0 +1,7 @@ +package part3; + +public class aufg1 { + public static void main(String[] args){ + System.out.println("Hello World!"); + } +} diff --git a/src/part3/aufg2.java b/src/part3/aufg2.java new file mode 100644 index 0000000..81ad147 --- /dev/null +++ b/src/part3/aufg2.java @@ -0,0 +1,23 @@ +package part3; + +public class aufg2 { + public static void main(String[] args){ + int a = 4; + int b = 2; + int c = 10; + + System.out.println("Mittelwert aus a,b,c: " + (a+b+c)/3); + System.out.println("a < b < c: " + ((a < b) && (b < c))); + System.out.println("a = n * b: " + ((a % b) == 0)); + System.out.println("2 Komplement c :" + ((~c) + 1)); + + c = Integer.MAX_VALUE; + + System.out.println("Maximaler Int Wert: " + c); + System.out.println("Int.MAX + 1: " + (c + 1)); + + b = 0xFFFFFFFF; + + System.out.println(b >>> 1); + } +} diff --git a/src/part3/aufg3.java b/src/part3/aufg3.java new file mode 100644 index 0000000..eabaa4c --- /dev/null +++ b/src/part3/aufg3.java @@ -0,0 +1,13 @@ +package part3; + +public class aufg3 { + public static void main(String[] args){ + int a = 3; + int b = 4; + int c = 5; + + boolean pythagoras_happy = (a*a +b*b == c*c); + + System.out.println(pythagoras_happy); + } +}