I'm a student , our teacher told us to make a static method called SOMME
to count the vectors sum , ( it's called SOMME
in the code ) and he said it should be static
, I didn't know where the problem is I tried almost every possible way to solve that but no solutions.
here is the Code :
import java.util.*;
public class Vecteur {// 3D
public double x;
public double y;
public double z;
public Vecteur (double x,double y,double z )
{
this.x=x;
this.y=y;
this.z=z;
}
public void affichage ()
{
System.out.println("("+x+","+y+","+z);
}
public double norme()
{
return Math.sqrt(x*x+y*y+z*z);
}
public static Vecteur somme(Vecteur v) // he told us to make it static nom matter what
{
Vecteur u=new Vecteur(0.0,0.0,0.0);
u.x=x+v.x;
u.y=y+v.y;
u.z=z+v.z;
return u;
}
public double produit(Vecteur v)
{
return x*v.x+y*v.y+z*v.z;
}
}