Tasks for 2023-05-22

This commit is contained in:
Christoph J. Scherr 2023-05-21 22:05:41 +02:00
parent 72f92770ba
commit 59e2bc107d
Signed by: PlexSheep
GPG Key ID: 25B4ACF7D88186CC
23 changed files with 520 additions and 49 deletions

View File

@ -2,12 +2,18 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/DHBWTest/DHBWTest.iml" filepath="$PROJECT_DIR$/DHBWTest/DHBWTest.iml" />
<module fileurl="file://$PROJECT_DIR$/Fahrzeug/Fahrzeug.iml" filepath="$PROJECT_DIR$/Fahrzeug/Fahrzeug.iml" />
<module fileurl="file://$PROJECT_DIR$/Kapselung/Kapselung.iml" filepath="$PROJECT_DIR$/Kapselung/Kapselung.iml" />
<module fileurl="file://$PROJECT_DIR$/ModifyStringArrayList/ModifyStringArrayList.iml" filepath="$PROJECT_DIR$/ModifyStringArrayList/ModifyStringArrayList.iml" />
<module fileurl="file://$PROJECT_DIR$/PassValid/PassValid.iml" filepath="$PROJECT_DIR$/PassValid/PassValid.iml" />
<module fileurl="file://$PROJECT_DIR$/Person/Person.iml" filepath="$PROJECT_DIR$/Person/Person.iml" />
<module fileurl="file://$PROJECT_DIR$/Rechtschreibung/Rechtschreibung.iml" filepath="$PROJECT_DIR$/Rechtschreibung/Rechtschreibung.iml" />
<module fileurl="file://$PROJECT_DIR$/SchiffeVersenken/SchiffeVersenken.iml" filepath="$PROJECT_DIR$/SchiffeVersenken/SchiffeVersenken.iml" />
<module fileurl="file://$PROJECT_DIR$/ThreadTask/ThreadTask.iml" filepath="$PROJECT_DIR$/ThreadTask/ThreadTask.iml" />
<module fileurl="file://$PROJECT_DIR$/Welt/Welt.iml" filepath="$PROJECT_DIR$/Welt/Welt.iml" />
<module fileurl="file://$PROJECT_DIR$/aviation/aviation.iml" filepath="$PROJECT_DIR$/aviation/aviation.iml" />
<module fileurl="file://$PROJECT_DIR$/density/density.iml" filepath="$PROJECT_DIR$/density/density.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/dhbw.iml" filepath="$PROJECT_DIR$/.idea/dhbw.iml" />
</modules>
</component>

View File

@ -4,13 +4,28 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="7992561a-5a42-4f2e-a81a-79d8a9c03d77" name="Changes" comment="del out dir">
<change afterPath="$PROJECT_DIR$/PassValid/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/PassValid/PassValid.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/PassValid/src/PassValid.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Rechtschreibung/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Rechtschreibung/Rechtschreibung.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Rechtschreibung/src/Rechtschreibung.java" afterDir="false" />
<list default="true" id="7992561a-5a42-4f2e-a81a-79d8a9c03d77" name="Changes" comment="more simple stuff">
<change afterPath="$PROJECT_DIR$/DHBWTest/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/DHBWTest/DHBWTest.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/DHBWTest/src/Main.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Fahrzeug/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Fahrzeug/Fahrzeug.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Fahrzeug/src/Fahrrad.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Fahrzeug/src/Fahrzeug.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ModifyStringArrayList/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ModifyStringArrayList/ModifyStringArrayList.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ModifyStringArrayList/src/ModifyStringArrayList.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ModifyStringArrayList/src/ModifyStringArrayListMain.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Person/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Person/Person.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Person/src/Person.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Person/src/PersonMain.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ThreadTask/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ThreadTask/ThreadTask.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ThreadTask/src/Main.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/density/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/density/density.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/density/src/Density.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
</list>
@ -19,6 +34,13 @@
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
@ -30,29 +52,50 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"ASKED_ADD_EXTERNAL_FILES": "true",
"ASKED_MARK_IGNORED_FILES_AS_EXCLUDED": "true",
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"git-widget-placeholder": "master",
"jdk.selected.JAVA_MODULE": "17",
"jdk.selected.com.intellij.ui.dsl.builder.impl.RowImpl.sdk": "17",
"last_opened_file_path": "/home/plex/Documents/code/java/dhbw",
"project.structure.last.edited": "Modules",
"project.structure.proportion": "0.0",
"project.structure.side.proportion": "0.0",
"settings.editor.selected.configurable": "preferences.lookFeel"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
&quot;ASKED_MARK_IGNORED_FILES_AS_EXCLUDED&quot;: &quot;true&quot;,
&quot;ASKED_SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;master&quot;,
&quot;jdk.selected.JAVA_MODULE&quot;: &quot;17&quot;,
&quot;jdk.selected.com.intellij.ui.dsl.builder.impl.RowImpl.sdk&quot;: &quot;17&quot;,
&quot;last_opened_file_path&quot;: &quot;/home/plex/Documents/code/java/dhbw&quot;,
&quot;project.structure.last.edited&quot;: &quot;Modules&quot;,
&quot;project.structure.proportion&quot;: &quot;0.0&quot;,
&quot;project.structure.side.proportion&quot;: &quot;0.0&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.lookFeel&quot;
},
"keyToStringList": {
"jdk.preference.com.intellij.ui.dsl.builder.impl.RowImpl.sdk": [
"17=/usr/lib/jvm/java-17"
&quot;keyToStringList&quot;: {
&quot;jdk.preference.com.intellij.ui.dsl.builder.impl.RowImpl.sdk&quot;: [
&quot;17=/usr/lib/jvm/java-17&quot;
]
}
}]]></component>
<component name="RunManager" selected="Application.PassValid">
}</component>
<component name="RunManager" selected="Application.Main">
<configuration name="Density" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Density" />
<module name="density" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="Main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Main" />
<module name="ThreadTask" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="ModifyStringArrayListMain" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="ModifyStringArrayListMain" />
<module name="ModifyStringArrayList" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="PassValid" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="PassValid" />
<module name="PassValid" />
@ -60,33 +103,20 @@
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="Rechtschreibung" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Rechtschreibung" />
<module name="Rechtschreibung" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="SchiffeVersenken" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="SchiffeVersenken" />
<module name="SchiffeVersenken" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="Welt" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Welt" />
<module name="Welt" />
<configuration name="PersonMain" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="PersonMain" />
<module name="Person" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.Main" />
<item itemvalue="Application.PersonMain" />
<item itemvalue="Application.ModifyStringArrayListMain" />
<item itemvalue="Application.Density" />
<item itemvalue="Application.PassValid" />
<item itemvalue="Application.Rechtschreibung" />
<item itemvalue="Application.SchiffeVersenken" />
<item itemvalue="Application.Welt" />
</list>
</recent_temporary>
</component>
@ -141,7 +171,14 @@
<option name="project" value="LOCAL" />
<updated>1682343561370</updated>
</task>
<option name="localTasksCounter" value="7" />
<task id="LOCAL-00007" summary="more simple stuff">
<created>1682344398810</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1682344398810</updated>
</task>
<option name="localTasksCounter" value="8" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -174,7 +211,8 @@
<MESSAGE value="weirdo intellij stuff" />
<MESSAGE value="schiffe overengineered" />
<MESSAGE value="del out dir" />
<option name="LAST_COMMIT_MESSAGE" value="del out dir" />
<MESSAGE value="more simple stuff" />
<option name="LAST_COMMIT_MESSAGE" value="more simple stuff" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>

29
DHBWTest/.gitignore vendored Normal file
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

11
DHBWTest/DHBWTest.iml Normal file
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>

5
DHBWTest/src/Main.java Normal file
View File

@ -0,0 +1,5 @@
public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}

29
Fahrzeug/.gitignore vendored Normal file
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

11
Fahrzeug/Fahrzeug.iml Normal file
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>

View File

@ -0,0 +1,3 @@
public class Fahrrad extends Fahrzeug {
}

View File

@ -0,0 +1,15 @@
public class Fahrzeug {
public static void main(String[] args) {
System.out.println("Hello world!");
}
private int max_speed;
public int getMax_speed() {
return max_speed;
}
public void setMax_speed(int max_speed) {
this.max_speed = max_speed;
}
}

29
ModifyStringArrayList/.gitignore vendored Normal file
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

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>

View File

@ -0,0 +1,29 @@
import java.util.ArrayList;
public interface ModifyStringArrayList {
/**
* @author Christoph J. Scherr <software@cscherr.de>
* @param als
* @return als but reversed
*/
public ArrayList<String> listeUmdrehen(ArrayList<String> als);
/**
* @author Christoph J. Scherr <software@cscherr.de>
* @param als
* @return als but shuffled
*/
public ArrayList<String> listeMischen(ArrayList<String> als);
/**
* @author Christoph J. Scherr <software@cscherr.de>
* @param als
* @return max of als
*/
public String listeMaxElement(ArrayList<String> als);
/**
* @author Christoph J. Scherr <software@cscherr.de>
* @param als
* @return max of als
*/
public String listeMinElement(ArrayList<String> als);
}

View File

@ -0,0 +1,30 @@
import java.util.ArrayList;
import java.util.Collections;
public class ModifyStringArrayListMain implements ModifyStringArrayList{
public static void main(String[] args) {
System.out.println("Hello world!");
}
@Override
public ArrayList<String> listeUmdrehen(ArrayList<String> als) {
Collections.reverse(als);
return als;
}
@Override
public ArrayList<String> listeMischen(ArrayList<String> als) {
Collections.shuffle(als);
return als;
}
@Override
public String listeMaxElement(ArrayList<String> als) {
return Collections.max(als);
}
@Override
public String listeMinElement(ArrayList<String> als) {
return Collections.min(als);
}
}

29
Person/.gitignore vendored Normal file
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

11
Person/Person.iml Normal file
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>

20
Person/src/Person.java Normal file
View File

@ -0,0 +1,20 @@
import java.util.Scanner;
public class Person {
private static Person INSTANCE;
private String name;
private String date;
public static Person getInstance(String name, String date) {
if(INSTANCE == null) {
INSTANCE = new Person();
INSTANCE.name = name;
INSTANCE.date = date;
}
else {
System.out.println("An instance already exists, ignoring args");
}
return INSTANCE;
}
private Person() {}
}

View File

@ -0,0 +1,13 @@
import java.util.Scanner;
public class PersonMain {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String name = scanner.nextLine();
String date = scanner.nextLine();
Person p = Person.getInstance(name, date);
Person p2 = Person.getInstance(name, date);
assert p == p2;
System.out.println("Same person");
}
}

29
ThreadTask/.gitignore vendored Normal file
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

11
ThreadTask/ThreadTask.iml Normal file
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>

37
ThreadTask/src/Main.java Normal file
View File

@ -0,0 +1,37 @@
public class Main implements Runnable {
private boolean oddTaken = false;
private int max;
private String name = "t0";
public static void main(String[] args) throws InterruptedException {
Main m0 = new Main();
Main m1 = new Main();
Thread t0 = new Thread(m0);
Thread t1 = new Thread(m1);
m0.max = 0xf000000;
m1.max = 0xf000000;
m1.oddTaken = true;
m1.name = "t1";
t0.start();
t1.start();
t0.join();
t1.join();
}
@Override
public void run() {
System.out.println("Thread start");
int i;
if (!oddTaken) {
// do the odds
i = 1;
}
else {
// do the equals
i = 0;
}
while (i < max) {
System.out.println(name + " - " + i);
i += 2;
}
}
}

29
density/.gitignore vendored Normal file
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

11
density/density.iml Normal file
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>

35
density/src/Density.java Normal file
View File

@ -0,0 +1,35 @@
import java.util.Scanner;
public class Density {
/**
* Folgende Formel soll berechnet werden: Dichte = Masse /Volumen
* Das Volumen darf nicht 0 sein, sonst kommt es zu einem Fehler
* Fange in diesem Fall den Fehler ab und gib eine Rückmeldung
* Konnte die Formel berechnet werden, soll das Ergebnis ausgegeben werden
* Erweitere die Aufgabe um folgende Punkte:
* Das Volumen soll nun nicht negativ und nicht über 1000 sein
* hierfür soll ein Fehler ausgeworfen werden
* Dieser soll wiederum abgefangen werden
*/
public static void main(String[] args) {
try {
Scanner scanner = new Scanner(System.in);
System.out.println("input volume");
int volume = scanner.nextInt();
if (volume == 0) {
throw new ArithmeticException("volume must not be 0");
} else if (volume < 0) {
throw new ArithmeticException("volume must not be positive");
} else if (volume >= 1000) {
throw new ArithmeticException("volume must not be more than 1000");
}
System.out.println("input mass");
int mass = scanner.nextInt();
// does not throw an division by 0 exception for float datatypes, instead says that density is 'Infinity'
float density = (float) mass / volume;
System.out.printf("density: %f%n", density);
} catch (ArithmeticException e) {
System.out.println(e.getMessage());
}
}
}