commit 2ff71e7a95367c3ddfda07305dcae186e9dfb000 Author: liam Date: Mon Oct 30 11:27:21 2023 +0100 test 1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f68d109 --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +### IntelliJ IDEA ### +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..69ace3f --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..3007dae --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/HelloWorld.java b/src/HelloWorld.java new file mode 100644 index 0000000..519c634 --- /dev/null +++ b/src/HelloWorld.java @@ -0,0 +1,7 @@ +import java.util.Arrays; + +public class HelloWorld { + public static void main(String[] args) { + System.out.println("Hello World"); + } +} diff --git a/src/Main.java b/src/Main.java new file mode 100644 index 0000000..268b983 --- /dev/null +++ b/src/Main.java @@ -0,0 +1,16 @@ + +//TIP To Run code, press or +// click the icon in the gutter. +public class Main { + public static void main(String[] args) { + //TIP Press with your caret at the highlighted text + // to see how IntelliJ IDEA suggests fixing it. + System.out.println("Hello and welcome!"); + + for (int i = 1; i <= 5; i++) { + //TIP Press to start debugging your code. We have set one breakpoint + // for you, but you can always add more by pressing . + System.out.println("i = " + i); + } + } +} \ No newline at end of file diff --git a/src/Zahlenfilter.java b/src/Zahlenfilter.java new file mode 100644 index 0000000..5108c7c --- /dev/null +++ b/src/Zahlenfilter.java @@ -0,0 +1,62 @@ +public class Zahlenfilter { + + public static void main(String[] args) { + Filter filter1 = new Filter(); + filter1.zahlenfiltern(); + } +} + +class Zahl { + + private int value; + + public Zahl(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + public boolean istDurchFuenfTeilbar() { + return value % 5 == 0; + } + + public boolean endetAufNeun() { + return value % 10 == 9; + } + + public int addieren(Zahl other) { + return this.value + other.getValue(); + } + + public boolean istDurchDreiTeilbar() { + return (value + (value - 1)) % 3 == 0; + } +} + +class Filter { + + public void zahlenfiltern() { + Zahl zahl; + Zahl vorherigeZahl = new Zahl(0); + for (int i = 0; i <= 300; i++) { + zahl = new Zahl(i); + if (zahl.istDurchFuenfTeilbar()) { + System.out.println(i + " ist durch 5 teilbar"); + } else { + if (zahl.endetAufNeun()) { + System.out.println(i + " endet auf 9"); + } else { + int summe = zahl.addieren(vorherigeZahl); + if (zahl.istDurchDreiTeilbar()) { + System.out.println(i + " und " + (i - 1) + " addiert ergeben " + summe + " und " + summe + " ist durch 3 teilbar"); + } else { + System.out.println(i + 1); + } + } + } + vorherigeZahl = zahl; + } + } +} diff --git a/untitled.iml b/untitled.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/untitled.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file