Advertisement
Guest User

Untitled

a guest
Nov 8th, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class graduation2 {
  4. public static void main(String[] args) {
  5. Scanner scanner= new Scanner(System.in);
  6. String name= scanner.nextLine();
  7. int grade=1;
  8. double note=0.0;
  9. while(grade<=12)
  10. {double note1=Double.parseDouble(scanner.nextLine());
  11. if (note1<=4)
  12. { double note2=Double.parseDouble(scanner.nextLine());
  13. if(note2<=4&&note1<=4)
  14. System.out.printf("%s has been excluded at %d grade",name,grade);
  15. }
  16. else{
  17. note+=note1;
  18. grade++;}
  19. }
  20. if(grade>=12){
  21. System.out.printf("%s graduated. Average grade: %.2f",name,note/12);}
  22. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement