From 4c00f4785cbf0aa60d60ab6fa44a20b5394aa821 Mon Sep 17 00:00:00 2001 From: Makussu Date: Wed, 27 Sep 2023 18:25:19 +0200 Subject: [PATCH] Lektion 2 --- .../Enthalten/Enthalten.pde | 21 ++++++++++++++++ .../Human_Resources/Human_Resources.pde | 13 ++++++++++ .../Human_Resources_2/Human_Resources_2.pde | 12 ++++++++++ .../Pulsieren/Pulsieren.pde | 24 +++++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 Lektion 2/Logische_Operatoren/Enthalten/Enthalten.pde create mode 100644 Lektion 2/Logische_Operatoren/Human_Resources/Human_Resources.pde create mode 100644 Lektion 2/Logische_Operatoren/Human_Resources_2/Human_Resources_2.pde create mode 100644 Lektion 2/Logische_Operatoren/Pulsieren/Pulsieren.pde diff --git a/Lektion 2/Logische_Operatoren/Enthalten/Enthalten.pde b/Lektion 2/Logische_Operatoren/Enthalten/Enthalten.pde new file mode 100644 index 0000000..4090232 --- /dev/null +++ b/Lektion 2/Logische_Operatoren/Enthalten/Enthalten.pde @@ -0,0 +1,21 @@ +float a = 10; +float b = 5; +float x = 6.3; + +void setup() { + + // Check whether a is bigger b or the other way around + if ( a < b) { + if (a < x && x < b) { + println("x innerhalb"); + } else { + println("x außerhalb"); + } + } else if ( a > b) { + if (b < x && x < a) { + println("x innerhalb"); + } else { + println("x außerhalb"); + } + } +} diff --git a/Lektion 2/Logische_Operatoren/Human_Resources/Human_Resources.pde b/Lektion 2/Logische_Operatoren/Human_Resources/Human_Resources.pde new file mode 100644 index 0000000..ecf9c59 --- /dev/null +++ b/Lektion 2/Logische_Operatoren/Human_Resources/Human_Resources.pde @@ -0,0 +1,13 @@ +// Ändere die Werte zum Testen +int alter = 33; +float note = 3.3; + +void setup() { + if (alter < 20 || alter > 60) { + println("lieber nicht"); + } else if (note < 3.0) { + println("Einstellen!"); + } else { + println("lieber nicht"); + } +} diff --git a/Lektion 2/Logische_Operatoren/Human_Resources_2/Human_Resources_2.pde b/Lektion 2/Logische_Operatoren/Human_Resources_2/Human_Resources_2.pde new file mode 100644 index 0000000..5feb2db --- /dev/null +++ b/Lektion 2/Logische_Operatoren/Human_Resources_2/Human_Resources_2.pde @@ -0,0 +1,12 @@ +float abschlussnote = 6; +int programmiererfahrung = 4; + +void setup() { + if (abschlussnote < 1.1 || (programmiererfahrung > 4 && abschlussnote < 3.1)) { + println("Eingestellt!"); + } else if (abschlussnote < 2.1 || programmiererfahrung > 3) { + println("zum Gespräch einladen"); + } else { + println("abgelehnt"); + } +} diff --git a/Lektion 2/Logische_Operatoren/Pulsieren/Pulsieren.pde b/Lektion 2/Logische_Operatoren/Pulsieren/Pulsieren.pde new file mode 100644 index 0000000..e923859 --- /dev/null +++ b/Lektion 2/Logische_Operatoren/Pulsieren/Pulsieren.pde @@ -0,0 +1,24 @@ +int d = 50; +boolean touched = false; + +void setup() { + size(400,400); +} +void draw() { + background(255); + + ellipse(width/2, height/2, d, d); + // increase and decrease ellipse + if (d < width && touched == false) { + d++; + } else if (d > 50 && touched == true) { + d--; + } + // switch between increasing and decreasing + if (touched == true && d == 50) { + touched = false; + } + if (d == width) { + touched = true; + } +}