Advertisement
perriercamille

vect.java

Apr 24th, 2012
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.22 KB | None | 0 0
  1. /**
  2.  *
  3.  * @author camille
  4.  */
  5.  
  6.  
  7. public class vect
  8. {
  9.     private int a, b, c;
  10.     private static int nV;
  11.  
  12.     vect()
  13.     {
  14.         this.a = this.b = this.c = 0;
  15.         nV++;
  16.     }
  17.  
  18.     vect(int pa, int pb, int pc)
  19.     {
  20.         this.a = pa;
  21.         this.b = pb;
  22.         this.c = pc;
  23.         nV++;
  24.     }
  25.  
  26.     public static int vectCounter()
  27.     {
  28.         return nV;
  29.     }
  30.  
  31.     public void multiply(int m)
  32.     {
  33.         this.a = this.a * m;
  34.         this.b = this.b * m;
  35.         this.c = this.c * m;
  36.     }
  37.  
  38.     public void sum(vect V1, vect V2)
  39.     {
  40.         this.a = V1.a + V2.a;
  41.         this.b = V1.b + V2.b;
  42.         this.c = V1.c + V2.c;
  43.     }
  44.  
  45.     public void mul(vect V1, vect V2)
  46.     {
  47.         this.a = V1.a * V2.a;
  48.         this.b = V1.b * V2.b;
  49.         this.c = V1.c * V2.c;
  50.     }
  51.  
  52.     public void display()
  53.     {
  54.         System.out.println("Vecteur 2D");
  55.         System.out.println("a = " + this.a);
  56.         System.out.println("b = " + this.b);
  57.         System.out.println("c = " + this.c);
  58.     }
  59.  
  60.     public int getA()
  61.     {
  62.         return this.a;
  63.     }
  64.  
  65.     public int getB()
  66.     {
  67.         return this.b;
  68.     }
  69.  
  70.     public int getC()
  71.     {
  72.         return this.c;
  73.     }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement