For loop trouble

Im new to java. I have an assignment where I have to make a grade calculator. When the enter button is clicked a joptionpane appears and asks the user how many grades are to be entered. After clicking ok another joptionpane appears asking for the scores so they can be stored and later averaged. The number of joptionpanes that appear asking for scores depends on the value that was entered into the first joptionpane. I have to create a for loop. I understand the concept of a for loop but I do not know how to correctly code the for loop so that the joptionpane repetitively asks for scores depending on the value entered in the first joptionpane. If anybody could point me in the right direction it would be greatly appreaciated.

I understand the concept of a for loop but I do not know how to correctly code the for loop so that...

The for loop has three bit to it, right? In this case they might be the starting value of some counter, the stopping condition and a bit that increments the counter. Inside the loop goes the stuff you want to happen repetitively.

To get anywhere you are going to have to take the first steps! Write some code and, however badly it turns out, you will have something to ask about.

You don't have to get all the way to a solution in one go. Just a loop which asks the user to enter a grade the right number of times will be a start. (You might also want to print that grade to test that everything is going well).

If your code doesn't do what you expect, post the code and say what you expected as well as what it actually does.

Well thats my problem I dont know what the code would be for the body. I would like for the 2nd joptionpane(scores) to repeat depending on the value entered into the 1st joption pane (number of scores to be entered), then the scores to be accumulated and averaged. Im pretty confident with if statements but I cant get past the for loop.

I would like for the 2nd joptionpane(scores) to repeat depending on the value entered into the 1st joption pane (number of scores to be entered), then ...

So put the second JOptionPane.showInputDialog() inside the body of the for loop if you want it to repeat.

But first check the three bits of the for loop to make sure they do what they should. (See my first response and the fact that the for loop involves what I was referring to as a counter which is another variable having nothing to do with the values the user enters. It is just there so that it can start at zero and keep increasing the right number of times.)

Im new to java. I have an assignment where I have to make a grade calculator. When the enter button is clicked a joptionpane appears and asks the user how many grades are to be entered. After clicking ok another joptionpane appears asking for the scores so they can be stored and later averaged. The number of joptionpanes that appear asking for scores depends on the value that was entered into the first joptionpane. I have to create a for loop. I understand the concept of a for loop but I do not know how to correctly code the for loop so that the joptionpane repetitively asks for scores depending on the value entered in the first joptionpane. If anybody could point me in the right direction it would be greatly appreaciated.

1. Instead of using an array and requiring the user to input how many grades they are entering (which isn't very convenient at all), use an ArrayList (which holds values without needing to specify a specific number of elements).