raul vargas wrote:
Yes, it has to be a while-loop. Those are the only loops I can work with.
I don't know how to initialize to -1.0
The example loop I have looks like this:
if it must, it must...
you are missing part of the while loop. Generally, they look like this:
Those braces are important. You need a closing one for each opening one, and your example is missing the closing one.
So you have the line "int i = 0;". That is just there to set up the starting conditions.
You then have "while (i < 10)". Each time through the loop, that condition is checked. So hopefully, i will be changing inside your loop, otherwise you will be stuck in there forever - what is called an "infinite loop".
So you need to put code inside the curly brackets - what is called the body of the loop. You have "i++" in the loop. Each time that line executes, i will be incremented by 1. so the first time, it will change from 0 to 1, then from 1 to 2, etc. That means that this loop will run ten times before quitting. That is convenient, since you have an array with ten elements. The common idiom is to use your variable i as an index (that's why i is often used as the variable name) of the array.
To access a specific element of the array, you say "arrayName[index]". In your example, you have one array called quizzes. you set a value the same way as any other double variable. If i had a double named "fred", i would say
fred = 1.0;
since i have an array, i can say
this.quizzes[3] = 1.0;
that would set the fourth element to 1.0 (remember, arrays are zero based indexed, so the first element is this.quizzes[0]).
So you could explicitly name all ten elements and set each to -1:
this.quizzes[0] = -1.0;
this.quizzes[1] = -1.0;
this.quizzes[2] = -1.0;
...etc
or you could use a variable...and index...that is changing. sounds like our variable 'i' from above.
Why don't you give it a try, and show us what you come back with.