@@ -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,43 @@ | |||
package Praktikum01; | |||
public class Zahlenfilter { | |||
public static void main(String[] args) { | |||
Zahlenfilter checker = new Zahlenfilter(); | |||
checker.checkZahlen(); | |||
} | |||
public void checkZahlen() { | |||
for (int i = 1; i <= 200; i++) { | |||
checkDurchFuenfTeilbar(i); | |||
checkEndetAufNeun(i); | |||
checkSummeMitVorgaenger(i); | |||
} | |||
} | |||
private void checkDurchFuenfTeilbar(int zahl) { | |||
if (zahl % 5 == 0) { | |||
System.out.println(zahl + " ist durch 5 teilbar!"); | |||
} | |||
} | |||
private void checkEndetAufNeun(int zahl) { | |||
if (zahl % 10 == 9) { | |||
System.out.println(zahl + " endet auf 9!"); | |||
} | |||
} | |||
private void checkSummeMitVorgaenger(int zahl) { | |||
if (zahl > 1) { | |||
int vorgaenger = zahl - 1; | |||
int summe = zahl + vorgaenger; | |||
if (summe % 3 == 0) { | |||
System.out.println(zahl + " und " + vorgaenger + " addiert ergeben " + summe + " und " + summe + " ist durch 3 teilbar."); | |||
} | |||
} | |||
} | |||
} |