u08 - u10
This commit is contained in:
parent
d90e8e22a1
commit
aa01aad344
Binary file not shown.
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue