diff --git a/u08/Wurzel.class b/u08/Wurzel.class new file mode 100644 index 0000000..3b29eee Binary files /dev/null and b/u08/Wurzel.class differ diff --git a/u08/Wurzel.java b/u08/Wurzel.java new file mode 100644 index 0000000..444d970 --- /dev/null +++ b/u08/Wurzel.java @@ -0,0 +1,11 @@ +/** + Klasse zum Wurzel Ziehen + */ +public class Wurzel { + /** + Zieht die n-te Wurzel einer Zahl + */ + public static double zahlHoch1Durchn(double zahl, int wurzelexponent) { + return Math.pow(zahl, 1.0 / wurzelexponent); + } +} diff --git a/u09/Cent.java b/u09/Cent.java new file mode 100644 index 0000000..5ac8545 --- /dev/null +++ b/u09/Cent.java @@ -0,0 +1,11 @@ +/** + Klasse zum errechnen der Cent-Stuecke + */ +public class Cent { + /** + Gibt aus, wie viele 20-Cent stuecke optimal in einem Geldbetrag enthalten sind + */ + public static int zaehle20CentStuecke(int cent) { + return cent % 100 / 20; + } +} diff --git a/u10/Swap.class b/u10/Swap.class new file mode 100644 index 0000000..23c62c0 Binary files /dev/null and b/u10/Swap.class differ diff --git a/u10/Swap.java b/u10/Swap.java new file mode 100644 index 0000000..3b94008 --- /dev/null +++ b/u10/Swap.java @@ -0,0 +1,16 @@ +import java.awt.*; +public class Swap { + public static void main(String[] args) { + Point p1= new Point(5, 2); + Point p2= new Point(-3, 6); + swapPoints(p1, p2); + System.out.println("p1: ("+p1.x+", "+p1.y+")"); + System.out.println("p2: ("+p2.x+", "+p2.y+")"); + } + + public static void swapPoints(Point p1, Point p2) { + Point ptmp = new Point(p1.x, p1.y); + p1.setLocation(p2.x, p2.y); + p2.setLocation(ptmp.x, ptmp.y); + } +}