Upload files to "Aufgaben/PTP_1"
This commit is contained in:
21
Aufgaben/PTP_1/Steigung.java
Normal file
21
Aufgaben/PTP_1/Steigung.java
Normal file
@@ -0,0 +1,21 @@
|
||||
public class Steigung {
|
||||
public static void main (String args[]){
|
||||
// Koordinaten x1 und y1 von Punkt P
|
||||
// P(x1 | y1)
|
||||
double x1 = 4;
|
||||
double y1 = 6;
|
||||
|
||||
// Koordinaten x2 und y2 von Punkt Q
|
||||
// Q(x2 | y2)
|
||||
double x2 = 2;
|
||||
double y2 = 1;
|
||||
|
||||
// m = (y2 - y1) / (x2 - x1)
|
||||
double m = (y2 - y1) / (x2 - x1);
|
||||
|
||||
System.out.println("P(" + x1 + " | " + y1 + ")");
|
||||
System.out.println("Q(" + x2 + " | " + y2 + ")");
|
||||
System.out.println("Steigung zwischen P und Q: " + m);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user