Jayden Orr - 7 months ago 48
Java Question

How to make a dynamic array Fibonacci series java program

I am in 8th grade. I am taking a 12th grade java course. I just started and my home work is to make a Fibonacci series dynamic array program. I don't know where to go. It is online so I can't ask a teacher or something. Please don't mark this down because last time I couldn't ask a question for 2 days! This was an example of a dynamic array I got. https://curriculum.kcdistancelearning.com/courses/PROG2s-HS-A08/s/unit3/resources/images/JV_3.3.9.1.JPG
I don't see how you can make the Fibonacci series out of it! Here is the Fibonacci series example I got. https://curriculum.kcdistancelearning.com/courses/PROG2s-HS-A08/s/practice_activity_images/JV_TN.3.2.JPG

You can combine the two examples, as such:

Take the `DynamicArrayOfInt` class, and add the `main` method of the `Fibonacci` class.

Insert a new statement at the beginning of the `main` method instantiating a `DynamicArrayOfInt` object, as such:

``````DynamicArrayOfInt arr = new DynamicArrayOfInt();
``````

Replace every instance of `numbers[x]` with `arr.get(x)`, and instances of `numbers[x] = y` with `arr.put(x, y)`.

Remove the leftover statements dealing with the numbers array. This will essentially make use of the DynamicArrayOfInt object. A sample output would look like this:

``````iplante\$ java DynamicArrayOfInt
Size of dynamic array increased to: 2
Fibonacci series:

0
1
Size of dynamic array increased to: 4
1
2
Size of dynamic array increased to: 8
3
5
8
13
Size of dynamic array increased to: 16
21
34
55
89
144
233
377
610
Size of dynamic array increased to: 32
987
1597
2584
4181
iplante\$
``````