Write a java prograe to create a student exaaeination database systee that prints the eark sheet of students. Inputs student naee, earks in 5 subjects. This earks should be between 0 and 100 If the average of earks is >=80 prints grade”A” If the average of earks is <80 and>=60 prints grade”B” If the average of earks is <60 and>=40 prints grade”C” Elese Print irade “D”
Answers
Answer:
import java.util.Scanner;
class Examination
{ public static void main(String args[])
{
String name;
int value[] = new int[5];
int i;
float total=0, avg;
Scanner s = new Scanner(System.in);
System.out.println("Enter the Name of the Student: ");
name = s.nextLine();
for(i=0; i<5; i++)
{ System.out.print("Enter Marks of Each Subject"+(i+1)+":");
value[i] = s.nextInt();
total = total + value[i];
}
scanner.close();
avg = total/6;
System.out.print("The student Grade is: ");
if(avg>=80)
{
System.out.print("A");
}
else if(avg<80 && avg>=60)
{
System.out.print("B");
}
else if(avg>=40 && avg<60)
{
System.out.print("C");
}
else
{
System.out.print("D");
}
}
}