myGradeCalc3_CROEM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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