# newbie question

ryan cheeseman
Greenhorn
Posts: 1
heres what i have
import cs1.Keyboard;
public class Final
{
public static void main(String[]args)
{
int num1 = 3;
int num2 = 5;
int min = 0;
System.out.println("You will now enter 3 test grades,\nthen 5 quiz grades\nthen the students average will be outputed:");
int test = 0;
while (num1!=min)
{
if ((test<0) || (test>100))
{
}
if ((test>0) && (test<100))
{
num1--;
}
}

int quiz = 0;
while (num2!=min)
{
if ((quiz<0) || (quiz>100))
{
}
if ((quiz>0) && (quiz<100))
{
num2--;
}
}

float tg = (test + test + test)/3;/*here i want to get the 3 test scores collected and divide them by 3 to get the average.....do i need to read them into a array, and if so how would i do this*/
System.out.println(tg);
}
}
thanks for any help

Scott Stoddard
Greenhorn
Posts: 5
Ryan...good to see yet another person learning Java.
It would seem that there is a simpler solution than arrays. This is because in your test and quiz mark entry sections you already have an 'if' structure to determine if the mark entered is a valid mark.

How about - in the section where you are decrementing num2 - you have something like
...assuming of course that you define quiztotal above this. Then, at the end, you would just need to divide quiztotal by 5. Of course the same could easily be done for 'test'.
By the way, the way that your code is currently written, a person could not have either a mark of 0 or a mark of 100 on a test or a quiz.
Scott.