QUOTE(hazezoos @ 24 Sep, 2008 - 07:19 PM)

ok ok.. but check this out..
my teacher wants the data entry/ the array print/ and the avg gpa.. in seperate methods..
so, can i have to have a main program with 4 seperate static methods?
whats the point of that?
Ask your teacher not me.
On the other hand, you can limit your STATIC main method to only one line that creates an instance of Mainprog and have all your code in Mainprog. Then you won't hae to write any more static method if you don't like them
CODE
import java.util.Scanner;
public class Mainprog{
public Mainprog() {
Scanner input = new Scanner(System.in);
System.out.println("Please enter the number of students: ");
int promptsize = input.nextInt();
Student[] studentarray = new Student[promptsize];
for (int i = 0; i < studentarray.length; i++){
System.out.println("Please enter the first and last name for student" + " #" + (i+1) +":");
String first = input.nextLine();
String last = input.nextLine();
System.out.println("Please enter the total credits for student" + " #" + (i+1) +":");
int credits = input.nextInt();
System.out.println("Please enter the GPA for" + " #" + (i+1) +":");
double gpa = input.nextDouble();
studentarray[i] = new Student(first, last, credits, gpa);
}
System.out.println(" Student Name" + " " + "Credits" + " " + "GPA");
double size = promptsize * 1.0;
double avggpa = 0;
for (int f = 0; f < studentarray.length; f++){
avggpa += (1.0 * (studentarray[f].getgpa()));
}
System.out.println("\n" + "Average GPA = " + avggpa / size );
}
// one static method to create a Mainprog
public static void main(String[] args){
new Mainprog();
}
}