This commit is contained in:
Orange_Dugongo 2016-10-21 16:11:56 +02:00
parent e333912462
commit e7a0bba79b
2 changed files with 20 additions and 0 deletions

BIN
src/Retta.class Normal file

Binary file not shown.

20
src/Retta.java Normal file
View File

@ -0,0 +1,20 @@
import java.awt.Point;
public class Retta{
public static void main(String [] args){
Point p1 = new Point(0, 3);
Point p2 = new Point(2, 4);
int x = 4;
System.out.println(x*getM(p1, p2) + getQ(p1, p2));
}
public static double getM(Point a, Point b){
return (b.getY()-a.getY())/(b.getX()-a.getX());
}
public static double getQ(Point a, Point b){
return a.getY()-a.getX()*getM(a, b);
}
}