Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

java project, methods and saving results in html

Status
Not open for further replies.

Fump1

Programmer
Jan 8, 2005
1
DE
hi, I'm a new member, I've made a thread already but it just got deleted and I got an email that I shouldn't post my email adress. Actually, I don't really have any other idea besides posting my whole coding which is in different files though. The trickly part, I guess like 800 lines of coding, not so nice in a thread, that's my problem :) The email told me to post the relevant part, but IMO everything is relevant, I'D have to post my test class with the main and the methods it needs in the other *.java files, + the txt files it reads from.

so, the full coding is simply too much for a post IMO, I will ask step by step then.

why does onemethod work and the other one doesn't, I'll post an example.
-----------------
in my main ...

Vektor b1 = null;
try {
b1 = v1.Addition(v2);
}
catch(Exception e) {System.out.println("error");
}
System.out.println("Vek Addition: \r\n" + b1.Vektor2String(" ; "));


and the method for it from another file is ...

public Vektor Addition(Vektor b) throws Exception
{ Vektor erg = new Vektor (vektor.length);

if (vektor.length != b.vektor.length)
{ throw new Exception("different dimensions");
} // end if
for (int xi=0; xi<vektor.length; xi=xi+1)
{ erg.vektor[xi] = vektor[xi]+b.vektor[xi];
} // end for xi
return erg;
} // end Addition(Vektor b)



---------------------

now the tricky part, same thing with another method doesn't work ...

b4 = v1.Skalarprod(v2);

...

System.out.println("Vek Skalarprodukt: \r\n" + b4.Vektor2String(" ; "));



and the method ...

public double Skalarprod(Vektor b) throws Exception
{ double erg = 0;

if (vektor.length != b.vektor.length)
{ throw new Exception("different dimensions");
}
for (int xi=0; xi<vektor.length; xi=xi+1)
{ erg = erg + (vektor[xi] * b.vektor[xi]);
}
return erg;
}
 
Some posting advices:

1.- If you don't post the error you get, there's nothing we can do

2.- If you post 800 lines of code, I don't think anyone will read them all

3.- The appropiate forum for this thread would be Java(Sun) Forum.

Cheers,

Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top