Skip to content

Instantly share code, notes, and snippets.

@Apo45ty
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Apo45ty/9963406 to your computer and use it in GitHub Desktop.
Save Apo45ty/9963406 to your computer and use it in GitHub Desktop.
myGradeCalc3_CROEM
public class myGradeCalc3{
public static void main(String[] args){
final int NUMBER_OF_STUDENTS = 10;
int[] grades = new int[NUMBER_OF_STUDENTS];
System.out.println("Welcome to the grade calculator, this program will can calculate the gradepoint average of "+NUMBER_OF_STUDENTS+" students.");
Scanner in = new Scanner(System.in);
//Enter the students grades
for(int i =0;i<NUMBER_OF_STUDENTS;i++){
System.out.println("Please Enter Grade "+i+":");
grades[i]= in.nextInt();
}
int sum =0;
for(int i =0;i<NUMBER_OF_STUDENTS;i++){
sum+=grades[i];
}
int average = sum / NUMBER_OF_STUDENTS;
System.out.println("The grade point average of the whole class is " + average );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment