Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
2.1 kB
0
Indexable
Never
package com.company;


import java.util.Scanner;

public class Main {

    public static final double MIN_GRADE_FOR_A = 3.8;
    public static final double MAX_GRADE_FOR_A = 4.0;

    public static final double MIN_GRADE_FOR_B = 3.6;
    public static final double MAX_GRADE_FOR_B = 3.8;

    public static final double MIN_GRADE_FOR_C = 3.2;
    public static final double MAX_GRADE_FOR_C = 3.6;

    public static final double MIN_GRADE_FOR_D = 2.0;
    public static final double MAX_GRADE_FOR_D = 3.2;

    public static void main(String[] args) {

        Scanner kbInput = new Scanner(System.in);


        System.out.println("Enter a Letter Grade: ");
        double grade1 = Double.parseDouble(kbInput.nextLine());

        System.out.println("Enter a Letter Grade: ");
        double grade2 = Double.parseDouble(kbInput.nextLine());

        System.out.println("Enter a Letter Grade: ");
        double grade3 = Double.parseDouble(kbInput.nextLine());

        System.out.println("Enter a Letter Grade: ");
        double grade4 = Double.parseDouble(kbInput.nextLine());


        double grades = Double.parseDouble(kbInput.nextLine());
        if (grades >= MIN_GRADE_FOR_A && grades <= MAX_GRADE_FOR_A) {
            System.out.println("Student will graduate Summa Cum Laude");


        } else if (grades >= MIN_GRADE_FOR_B && grades <= MAX_GRADE_FOR_B) {
            System.out.println("Student will graduate Magna Cum Laude ");


        } else if (grades >= MIN_GRADE_FOR_C && grades <= MAX_GRADE_FOR_C) {
            System.out.println("Student will graduate Cum Laude ");


        } else if (grades >= MIN_GRADE_FOR_D && grades <= MAX_GRADE_FOR_D) {
            System.out.println("Student will graduate ");


        } else {
            System.out.println("Student will not graduate ");
        }

        double allGrades = calcGrades(grade1, grade2, grade3, grade4);
        System.out.println("GPA is " + allGrades);
    }

    public static double calcGrades ( double grade1, double grade2, double grade3, double grade4){
        return (grade1 + grade2 + grade3 + grade4) / 4;
            }