import java.util.*;
import java.lang.*;
import java.io.*;

class Main {
    public static void main(String[] args) {
        Scanner t = new Scanner (System.in);
        System.out.println("Digite suas 4 notas");
        double a = t.nextDouble();
        double b = t.nextDouble();
        double c = t.nextDouble();
        double d = t.nextDouble();
        double media = (a + (b * 2) + (c * 3) + d) / 7;
        if ( a >= 0 && b >= 0 && c >= 0 && d >= 0) {
        if (media >= 9) {
            System.out.println("A");
        }
        if (media < 9 && media >= 7.5){
            System.out.println("B");
        }
        if (media < 7.5 && media >= 6){
            System.out.println("C");
        }
        if (media < 6 && media >= 4){
            System.out.println("D");      
        }
        if (media < 4){
            System.out.println("E");
        }
        } else {
            System.out.println("Ocorreu um erro. Verifique se digitou as notas corretamente!");
        }
        t.close();
    }
}




    

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: