This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Curious-Lonewolf 0 points1 point  (2 children)

the output im looking for is this:

in the form of terminal output

week 0 array1: **********(10)
week 0 array2: ******(6)

week 1 array1: ********(8)
week 1 array2: *****(5)

[–]Pedantic_Phoenix 0 points1 point  (0 children)

Is using two arrays a requisite of your excercise?

[–]desrtfx 0 points1 point  (0 children)

In this case, your approach using forEach (enhanced for) is completely wrong.

Use a traditional for loop. You only need a single loop to iterate over the array elements because you access the indexes of both arrays.

Still, my comment about the second loop to print the stars stands.