Praktikum 1 Abgabe

This commit is contained in:
Andreas Greiner 2021-03-22 10:07:15 +01:00
commit f2f9aaf1c7
10 changed files with 119 additions and 0 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/../../../../../../:\Users\andre\IdeaProjects\Programmieren 2\.idea/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

6
.idea/misc.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_13" project-jdk-name="16" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

9
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Programmieren 2.iml" filepath="$PROJECT_DIR$/Programmieren 2.iml" />
<module fileurl="file://$PROJECT_DIR$/SuperPangWorld/SuperPangWorld.iml" filepath="$PROJECT_DIR$/SuperPangWorld/SuperPangWorld.iml" />
</modules>
</component>
</project>

11
Programmieren 2.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>

1
README.md Normal file
View File

@ -0,0 +1 @@
Umsetzung des Panic Mode von Super Pang World in Java für den Kurs Programmierung II and der TH Deggendorf.

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,57 @@
package superpangworld;
/**
* Die Position eines Objekts auf einem Fenster anhand zweidimensoinaler Koordinaten
*/
public class Position {
/** Die x-Koordinate */
public double x;
/** Die y-Koordinate */
public double y;
/**
* Erzeugt eine Position mit den übergebenen Koordinaten
*
* @param x die x-Koordinate des Objekts
* @param y die y-Koordinate des Objekts
*/
public Position(double x, double y) {
this.x = x;
this.y = y;
}
/**
* Veränderung der Position um einen Pixel nach links
*/
public void left() {
x--;
}
/**
* Veränderung der Position um einen Pixel nach rechts
*/
public void right() {
x++;
}
/**
* Veränderung der Position um einen Pixel nach oben
*/
public void up() {
y--;
}
/**
* Veränderung der Position um einen Pixel nach unten
*/
public void down() {
y++;
}
@Override
public String toString() {
return "Position(" + (int) Math.round(x) + ", " + (int) Math.round(y) + ')';
}
}

View File

@ -0,0 +1,16 @@
package superpangworld;
public class Start {
public static void main(String[] args) {
System.out.println("Spiel");
Position pos1 = new Position(100, 110);
Position pos2 = new Position(200, 300);
pos2.down();
pos2.right();
System.out.println(pos1);
System.out.println(pos2);
}
}