/**
* Returns the number of floats in this list.
* @return the number of floats.
*/
public int countFloats() {
for (int i=0; i<n; ++i)
// TODO: implement this method.
...
Type: Posts; User: jasonm
/**
* Returns the number of floats in this list.
* @return the number of floats.
*/
public int countFloats() {
for (int i=0; i<n; ++i)
// TODO: implement this method.
...
What type is a? Is it the float array that belongs to FloatList? Java arrays are objects. I could be wrong, but I don't think they have an append() method. Could you provide the actual error...
Primitives are simple data types, built into to Java language, and just hold a particular kind of value - they don't have methods. You can read about all of the primitives here. So, "float" is a...
What I am trying to get you to do is show me how you expect your class to work, as well as how it is working now. Without being able to do this, how do you know if your code is right or wrong?
...
Okay, so now what do you expect to happen when you run this, and what actually happens? For simplicity, maybe change your example to eliminate the randomness (in the for(...) loop) for the time...
Can you provide an example using your FloatList? Indicate what you expect to happen as well as what actually happens. That should provide a good starting point for getting this coded up.