Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package figury.zad6;
- /**
- *
- * @author bomba
- */
- public class Czworokąt {
- private Linia A;
- private Linia B;
- private Linia C;
- private Linia D;
- private boolean error;
- Czworokąt(){
- A = new Linia();
- B = new Linia();
- C = new Linia();
- D = new Linia();
- }
- Czworokąt(Linia A, Linia B, Linia C, Linia D){
- if(!A.equals(B) && !A.equals(C) && !A.equals(D) && !B.equals(C) && !B.equals(D) && !C.equals(D)){
- if(A.SprawdzeniePunktow(A, B) && A.SprawdzeniePunktow(A, C) && A.SprawdzeniePunktow(A, D) && B.SprawdzeniePunktow(B, C) && B.SprawdzeniePunktow(B, D) && C.SprawdzeniePunktow(C,D)){
- this.A = new Linia(A);
- this.B = new Linia(B);
- this.C = new Linia(C);
- this.D = new Linia(D);
- }
- else{
- System.out.println("Czworokąt nie może powstać z podanych linii");
- error = true;
- }
- }
- else{
- System.out.println("Czworokąt nie może powstać z podanych linii");
- error = true;
- }
- }
- Czworokąt(Czworokąt ABCD){
- this.A = ABCD.getA();
- this.B = ABCD.getB();
- this.C = ABCD.getC();
- this.D = ABCD.getD();
- }
- public void przesun(int dx, int dy){
- this.A.przesun(dx, dy);
- this.B.przesun(dx, dy);
- this.C.przesun(dx, dy);
- this.D.przesun(dx, dy);
- }
- @Override
- public String toString(){
- return "Czworokąt{ " + A + " " + B + " " + C + " " + D + '}';
- }
- public Linia getA(){ return A; }
- public Linia getB(){ return B; }
- public Linia getC(){ return C; }
- public Linia getD(){ return D; }
- public void setA(Linia A){ this.A = A; }
- public void setB(Linia B){ this.B = B; }
- public void setC(Linia C){ this.C = C; }
- public void setD(Linia D){ this.D = D; }
- public boolean getError(){ return error; }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement