@@ -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 |
@@ -0,0 +1,11 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<module type="JAVA_MODULE" version="4"> | |||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | |||
<exclude-output /> | |||
<content url="file://$MODULE_DIR$"> | |||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | |||
</content> | |||
<orderEntry type="inheritedJdk" /> | |||
<orderEntry type="sourceFolder" forTests="false" /> | |||
</component> | |||
</module> |
@@ -0,0 +1,5 @@ | |||
public class HelloWorld{ | |||
public static void main(String[] args) { | |||
System.out.println("HelloWorld!"); | |||
} | |||
} |
@@ -0,0 +1,41 @@ | |||
package praktikum01; | |||
public class Zahlenfilter { | |||
public static void main(String[] args) { | |||
Zahlenfilter filter = new Zahlenfilter(); | |||
filter.filterZahlen(1, 200); | |||
} | |||
public void filterZahlen(int start, int end) { | |||
for (int i = start; i <= end; i++) { | |||
if (istDurchFuenfTeilbar(i)) { | |||
System.out.println(i + " ist durch 5 teilbar!"); | |||
} | |||
if (endetAufNeun(i)) { | |||
System.out.println(i + " endet auf 9!"); | |||
} | |||
if (ergibtMitVorgaengerDurchDreiTeilbareSumme(i)) { | |||
int vorgaenger = i - 1; | |||
int summe = i + vorgaenger; | |||
System.out.println(i + " und " + vorgaenger + " addiert ergeben " + summe + " und " + summe + " ist durch 3 teilbar."); | |||
} | |||
} | |||
} | |||
private boolean istDurchFuenfTeilbar(int zahl) { | |||
return zahl % 5 == 0; | |||
} | |||
private boolean endetAufNeun(int zahl) { | |||
return zahl % 10 == 9; | |||
} | |||
private boolean ergibtMitVorgaengerDurchDreiTeilbareSumme(int zahl) { | |||
int vorgaenger = zahl - 1; | |||
int summe = zahl + vorgaenger; | |||
return summe % 3 == 0; | |||
} | |||
} |