Program to Find the Average of 5 Grades

import java.util.Scanner;

/* AniBlogger12
 * Finding the letter grade based on the percent grade entered
 */
public class AGRP {

	public static void main(String[] args) {
		System.out.println("Please enter 5 of your grades in integers:");
		Scanner kb = new Scanner(System.in);
// 5 grades inputed 
		int g1 = kb.nextInt();
		int g2 = kb.nextInt();
		int g3 = kb.nextInt();
		int g4 = kb.nextInt();
		int g5 = kb.nextInt();
//average grade
		double grade = (g1 + g2 + g3 + g4 + g5) / 5;
//grade rounded to nearest integer: use Math.rint and cast it to make it an int.
		int rgrade = (int) Math.rint(grade);
// grade rounded and printed out to the nearest 10th, use %.1f.%n to round it one decimal place to the left
		System.out.printf("The grade rounded to the nearest tenth is %.1f.%n", grade);
// If the grade is greater than or equal to(>=) 90, the grade is an A.
		if (Math.rint(rgrade) >= 90) {
			System.out.println("The grade is an A.");
		}
// If it isn't, then if the grade is greater than or equal to(>=) 80
		else if (rgrade >= 80 ) {
			System.out.println("The grade is a B.");
		}
//If it isn't, then if the grade is greater than or equal to(>=) 70
		else if (rgrade >= 70 ) {
			System.out.println("The grade is a C.");
		}
//If it isn't, then if the grade is greater than or equal to(>=) 60
		else if (rgrade >= 60 ) {
			System.out.println("The grade is a D.");
		}
//If it isn't, then if the grade is less than(<) 60, it is an F.
		else if (rgrade < 60) {
			System.out.println("The grade is an F.");
		}
	}

}

Design a site like this with WordPress.com
Get started