[Solved] How to make a dynamic array Fibonacci series java program? [closed]


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$

1

solved How to make a dynamic array Fibonacci series java program? [closed]