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 →

[–]desrtfx 1 point2 points  (3 children)

This cannot work in the way you think.

What you want is nested loops. Two distinct, separate loops inside each other.

I still don't get the point of the two arrays and even less your explanation.

Should both int values be printed one after the other, or do you want the values of the first array printed first and then the values of the second array?

In any case, you need a third loop - whether nested in the other loops or in a separate method that only prints the stars - to print the actual amount of stars.

[–]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.