Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package figury.zad6;
  7.  
  8. /**
  9. *
  10. * @author bomba
  11. */
  12. public class Czworokąt {
  13.  
  14. private Linia A;
  15. private Linia B;
  16. private Linia C;
  17. private Linia D;
  18. private boolean error;
  19.  
  20. Czworokąt(){
  21. A = new Linia();
  22. B = new Linia();
  23. C = new Linia();
  24. D = new Linia();
  25. }
  26.  
  27. Czworokąt(Linia A, Linia B, Linia C, Linia D){
  28. if(!A.equals(B) && !A.equals(C) && !A.equals(D) && !B.equals(C) && !B.equals(D) && !C.equals(D)){
  29. 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)){
  30. this.A = new Linia(A);
  31. this.B = new Linia(B);
  32. this.C = new Linia(C);
  33. this.D = new Linia(D);
  34. }
  35. else{
  36. System.out.println("Czworokąt nie może powstać z podanych linii");
  37. error = true;
  38. }
  39. }
  40. else{
  41. System.out.println("Czworokąt nie może powstać z podanych linii");
  42. error = true;
  43. }
  44. }
  45.  
  46. Czworokąt(Czworokąt ABCD){
  47. this.A = ABCD.getA();
  48. this.B = ABCD.getB();
  49. this.C = ABCD.getC();
  50. this.D = ABCD.getD();
  51. }
  52.  
  53. public void przesun(int dx, int dy){
  54. this.A.przesun(dx, dy);
  55. this.B.przesun(dx, dy);
  56. this.C.przesun(dx, dy);
  57. this.D.przesun(dx, dy);
  58. }
  59.  
  60. @Override
  61. public String toString(){
  62. return "Czworokąt{ " + A + " " + B + " " + C + " " + D + '}';
  63. }
  64.  
  65. public Linia getA(){ return A; }
  66. public Linia getB(){ return B; }
  67. public Linia getC(){ return C; }
  68. public Linia getD(){ return D; }
  69. public void setA(Linia A){ this.A = A; }
  70. public void setB(Linia B){ this.B = B; }
  71. public void setC(Linia C){ this.C = C; }
  72. public void setD(Linia D){ this.D = D; }
  73.  
  74. public boolean getError(){ return error; }
  75.  
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement