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