Boa noite
Tenho duvidas na hora de chamar o metodo na classe principal.
Sou bem principiante msm, e então por isso peço uma ajudinha
Um metodo eu entendi e passei os paramentros
agora o outro nao entendi, se eu n passo parametros e só passo o println ele dá erro, se passo parametros como fiz com o primeiro metodo tb da erro, e nao sei pq, será q por gentileza alguem pode me responder o pq não dá certo, pq to perdida msm.......................
public class PVetores {
public float x,y;
public PVetores(float ax,float ay) {
this.x=ax; this.y=ay;
}
public void move(float dx,float dy){
this.x+=dx; this.y+=dy;
}
public void mostra(){
System.out.println("("+this.x+","+this.y+")");
}
//metodo para retornar o modulo do vetor
public void RetornaModulo (float x, float y){
double n;
n = (float) Math.sqrt(x*x + y*y);
System.out.println("O modulo do vetor M é:" + "+this.n+");
}
//metodo para tornar o vetor M um vetor unitario
public void VetorUnitario (float x, float y, float v1, float v2, float n){
v1= (x/n);
v2= (y/n);
System.out.println ("O vetor unitário de M é:" + "+this.v1" + "+this.v2");
}
}
class PrincPVetores {
public static void main(String args[]) {
PVetores vt;
vt=new PVetores ((float)1.0,(float)0.0);
vt.mostra();
vt.move(1,1);
vt.mostra();
vt.x=100;
vt.mostra();
double alt = 1.0;
double alt1 = 0.0;
vt.RetornaModulo ((float) alt , (float) alt1);
vt.VetorUnitario (){
System.out.println ("O vetor unitário de M é:" + "+this.v1" + "+this.v2");
}
}
}
E OS ERROS
// SE NAO COLOCO PARAMETROS
';' expected vt.VetorUnitario <>{
//SE COLOCO PARAMETROS
'.class' expected vt.VetorUnitario <float alt3, float alt3, float alt4>{
obrigada
Abraços
