Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Graduation {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String student = scanner.nextLine();
- double totalGrades = 0;
- int classCount = 0;
- while (classCount < 12){
- double grade = Double.parseDouble(scanner.nextLine());
- if (grade >= 4.00){
- classCount++;
- totalGrades += grade;
- }
- }
- System.out.printf("%s graduated. Average grade: %.2f",student,totalGrades / 12);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement