package studentgrade;
import java.util.Scanner;
public class StudentGrade {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter Prelim Grade: ");
double prelim = input.nextDouble();
System.out.print("Enter Midterm Grade: ");
double midterm = input.nextDouble();
System.out.print("Enter Final Grade: ");
double finalGrade = input.nextDouble();
double subjectGrade = (prelim + midterm + (finalGrade * 2)) / 4;
String gradeEquivalent;
if (subjectGrade >= 96) {
gradeEquivalent = "1.00";
} else if (subjectGrade >= 94) {
gradeEquivalent = "1.25";
} else if (subjectGrade >= 92) {
gradeEquivalent = "1.50";
} else if (subjectGrade >= 89) {
gradeEquivalent = "1.75";
} else if (subjectGrade >= 87) {
gradeEquivalent = "2.00";
} else if (subjectGrade >= 84) {
gradeEquivalent = "2.25";
} else if (subjectGrade >= 80) {
gradeEquivalent = "2.50";
} else if (subjectGrade >= 78) {
gradeEquivalent = "2.75";
} else if (subjectGrade >= 75) {
gradeEquivalent = "3.00";
} else {
gradeEquivalent = "5.00";
}
System.out.println("Subject Grade: " + subjectGrade);
System.out.println("Grade Equivalent: " + gradeEquivalent);
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter