test 1
This commit is contained in:
commit
2ff71e7a95
29
.gitignore
vendored
Normal file
29
.gitignore
vendored
Normal file
@ -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
|
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@ -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
|
6
.idea/misc.xml
generated
Normal file
6
.idea/misc.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/untitled.iml" filepath="$PROJECT_DIR$/untitled.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
7
src/HelloWorld.java
Normal file
7
src/HelloWorld.java
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class HelloWorld {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("Hello World");
|
||||||
|
}
|
||||||
|
}
|
16
src/Main.java
Normal file
16
src/Main.java
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
|
||||||
|
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
|
||||||
|
public class Main {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
//TIP Press <shortcut actionId="ShowIntentionActions"/> 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 <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
|
||||||
|
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
|
||||||
|
System.out.println("i = " + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
62
src/Zahlenfilter.java
Normal file
62
src/Zahlenfilter.java
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
untitled.iml
Normal file
11
untitled.iml
Normal file
@ -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>
|
Loading…
x
Reference in New Issue
Block a user