Skip to content
Advertisement

Return user input into setter function

I have been working on an assignment and i am stuck at here. Basically i have 1 class which defines all functions and members.

And another class to initialize and manipulate objects.

Here is my first class code.

JavaScript

And here is my second class code.

JavaScript

I get an error when values in the for loop. Can someone help me? I’m pretty new to programming and studying java for 2 months now. What am i doing wrong?

Here is my objectives.

  1. Create an array of objects and get user input for number of objects to be manipulated.
  2. Read and display array of object values.

Thank you!

Advertisement

Answer

You have to initialize the objects of your array. After the line:

JavaScript

do a for loop like:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement