import java.util.Scanner;
public class StudentsMarks {
public static void main(String[] args) {
String studentName = " ";
int sum = 0;
double average = 0;
double[] score = new double[3];
Scanner input = new Scanner(System.in);
Scanner scan = new Scanner(System.in);
System.out.println("Enter student full names and press Enter: ");
studentName = input.nextLine();
System.out.println("Enter 3 marks separated by spaces and press Enter: ");
for (int i = 0; i < score.length; i++) {
score[i] = scan.nextDouble();
}
for (int i = 0; i < score.length; i++) {
sum += score[i];
}
average = sum / 3;
int avg = (int) average;
if (avg >= 101) {
System.out.println("Student name: "+studentName+"Grade Level: X Comment: Invalid Marks!!, Marks too high.");
} else if (avg >= 80 || avg <= 100) {
System.out.println("Student name: "+studentName+" 1 Magnificent!!");
} else if (avg >= 70 || avg <= 79) {
System.out.println("Student name: "+studentName+" 2 Excellent!!");
} else if (avg >= 60 || avg <= 69) {
System.out.println("Student name: "+studentName+" 3 Good work!!");
} else if (avg >= 50 || avg <= 59) {
System.out.println("Student name: "+studentName+" 4 Good!!");
} else if (avg >= 0 || avg <= 49) {
System.out.println("Student name: "+studentName+" 0 Fail – Try again next Year!!");
} else if (avg >= 101) {
System.out.println("Grade Level: X Comment: Invalid Marks!!, Marks too high.");
}
input.close();
scan.close();
}
}
Comments
Leave a comment