KAMELE SIND KEINE TIERE
parent
d8cd96b96c
commit
a4bd2d5284
|
@ -19,4 +19,12 @@ public class Gerade
|
||||||
m = (P1.y - P2.y)/(P1.x - P2.x);
|
m = (P1.y - P2.y)/(P1.x - P2.x);
|
||||||
c = P1.y - m * P1.x;
|
c = P1.y - m * P1.x;
|
||||||
}
|
}
|
||||||
|
public Punkt schneide (Gerade h){
|
||||||
|
double x = (h.c - c ) / (m - h.m);
|
||||||
|
double y = m * x + c;
|
||||||
|
return new Punkt(x, y);
|
||||||
|
}
|
||||||
|
public String toString(){
|
||||||
|
return "y = " + m + " * x + " + c;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
public class Person
|
||||||
|
{
|
||||||
|
String Vorname;
|
||||||
|
String Nachname;
|
||||||
|
}
|
|
@ -19,4 +19,7 @@ public class Punkt
|
||||||
x = x + _x;
|
x = x + _x;
|
||||||
y = y + _y;
|
y = y + _y;
|
||||||
}
|
}
|
||||||
|
public String toString(){
|
||||||
|
return "P(" + x + "|" + y + ")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Beschreiben Sie hier die Klasse Schüler.
|
||||||
|
*
|
||||||
|
* @author (Ihr Name)
|
||||||
|
* @version (eine Versionsnummer oder ein Datum)
|
||||||
|
*/
|
||||||
|
public class Schüler extends Person
|
||||||
|
{
|
||||||
|
int klasse;
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
public class Test
|
||||||
|
{
|
||||||
|
public static void test(){
|
||||||
|
Punkt P = new Punkt(1, -1);
|
||||||
|
Punkt Q = new Punkt(3,3);
|
||||||
|
Gerade g = new Gerade(P,Q);
|
||||||
|
System.out.println("Gerade g:" );
|
||||||
|
System.out.println(g.toString());
|
||||||
|
Gerade h = new Gerade(-0.5, 2);
|
||||||
|
System.out.println("Gerade h:" );
|
||||||
|
System.out.println(h.toString());
|
||||||
|
Punkt S = g.schneide(h);
|
||||||
|
System.out.println("Schnittpunkt: ");
|
||||||
|
System.out.println(S.toString());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue