Browse Source

test 1

master
liam 1 year ago
commit
2ff71e7a95
9 changed files with 153 additions and 0 deletions
  1. 29
    0
      .gitignore
  2. 8
    0
      .idea/.gitignore
  3. 6
    0
      .idea/misc.xml
  4. 8
    0
      .idea/modules.xml
  5. 6
    0
      .idea/vcs.xml
  6. 7
    0
      src/HelloWorld.java
  7. 16
    0
      src/Main.java
  8. 62
    0
      src/Zahlenfilter.java
  9. 11
    0
      untitled.iml

+ 29
- 0
.gitignore View 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
- 0
.idea/.gitignore View 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
- 0
.idea/misc.xml View 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
- 0
.idea/modules.xml View 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
- 0
.idea/vcs.xml View 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
- 0
src/HelloWorld.java View File

@@ -0,0 +1,7 @@
import java.util.Arrays;

public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}

+ 16
- 0
src/Main.java View 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
- 0
src/Zahlenfilter.java View 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
- 0
untitled.iml View 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…
Cancel
Save