• Post Reply Bookmark Topic Watch Topic
  • New Topic

Dynamic Array  RSS feed

 
char Something
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am new to Java and am taking an online course to help improve my skills. My teacher asked us to create a Dynamic Array that generates the first 20 numbers of the fibonacci numbers. He told us how to start it, but did not teach us how to do the rest. Everyone in my class is confused. Any help would be AMAZING. Here is what he has provided so far:
 
Norm Radder
Rancher
Posts: 2240
28
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
  how to do the rest.

Can you explain what "the rest" means?

Please wrap any posted code in code tags as I've done on post#1
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I would argue that the professor did more than just "start it". It looks almost complete -- with the exception of some error handling, and making sure that the array is increased correctly. Perhaps, there is confusion because the professor did too much. There is much code that needs explanation.

Henry
 
char Something
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Henry

I still need to include the Fibonacci numbers. Here is what my teacher posted:

The Dynamic Arrays program can be a frustrating one! Don't feel bad if that's the case for you; it isn't worth many points, and this is a very common stumbling block. You're not alone! Here's some advice that I gave to a vexed student:

So you'll make two classes here. The first is a copy of the DynamicArrayOfInt class exactly as written (needs to be public), and the second contains a main() method that creates a DynamicArrayOfInt object. Once you declare that object, you use the get() and put() methods from the class to fill it with (and display) the Fibonacci numbers. You won't use the ReverseWithDynamicArray code at all, as this is just a demonstration of one thing you can do with a DynamicArrayOfInt - you're writing your own version of that. I hope that helps!

...I hope that helps!

So I worked on it some more and here is what I got for creating the Fibonacci sequence. The only problem is I get an error when running that reads:

Here is the code that I copied from my teachers book. I don't know why it is giving me this error. :

Thanks for the help!
 
Carey Brown
Saloon Keeper
Posts: 3329
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think "newint" was supposed to be "new int".
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!