u11
This commit is contained in:
parent
510e2489e8
commit
7a01aa1c9d
|
@ -9,7 +9,7 @@ public class Swap {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void swapPoints(Point p1, Point p2) {
|
public static void swapPoints(Point p1, Point p2) {
|
||||||
Point ptmp = new Point(p1.x, p1.y);
|
Point ptmp = new Point(p1);
|
||||||
p1.setLocation(p2.x, p2.y);
|
p1.setLocation(p2.x, p2.y);
|
||||||
p2.setLocation(ptmp.x, ptmp.y);
|
p2.setLocation(ptmp.x, ptmp.y);
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -1,15 +1,17 @@
|
||||||
|
import java.awt.Point;
|
||||||
public class Scale {
|
public class Scale {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
int x= 4;
|
int x= 4;
|
||||||
int y= 3;
|
int y= 3;
|
||||||
int faktor= 2;
|
int faktor= 2;
|
||||||
|
|
||||||
// ... hier kommt der Code hin (ggf. mehrere Anweisungen),
|
Point p = new Point(x,y);
|
||||||
// der zum Aufruf der Methode skaliere benötigt wird
|
skaliere(p, faktor);
|
||||||
|
|
||||||
System.out.println();
|
System.out.println(p.x + " " + p.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hier fehlt Ihre Methode skaliere
|
public static void skaliere(Point p, int faktor) {
|
||||||
|
p.setLocation(p.x * faktor, p.y * faktor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue