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