Right, that worked.
Thank you very much. :]
User Profile
Collapse
-
missing return statement
So this is my code. I get the error missing return statement, but I don't see where. Any suggestions would be greatly appreciated.
(I realize there are probably some other issues in this code as well, but for now, I'm just focused on this one since it's currently preventing me from realizing the others.)
Code:public boolean addHouse ( House a ) { boolean done = false; for (int i = 0; i < collection.length;
-
-
Uhm...kay?
The thing that's throwing me off is that my class hasn't said a word about vectors so I don't really know how to work with them.
If I wanted to make an array out of the vector in the dotProduct, how would I do that?
Something like...
Code:double [] bArray = new double[b.size()] //the b.size() gives me an error...and i've imported java.util.* so what do i do here?
Leave a comment:
-
vectors and arrays
"3. (5 points) Write a method for a class that uses an array
For the Vector class given below, write a method that computes the dot product of the Vector "this" object with the Vector object passed as an argument, "b". The dot-product is the sum of the products of the corresponding elements of the vectors. The Vectors must be the same length for the dot-product to be defined. For example, if a = {1,2,3,4}... -
help with generating random numbers between -1 and 1
Math.random() returns a number in the interval [0, 1), right?
So, if I need to change the interval to (-1, 1), would I use do this...
xCoord = Math.random() * 2 - 1;
to change the range to be 2 (so it'd be [0, 2) then subtract one to shift it to (-1, 1)?
No activity results to display
Show More
Leave a comment: