Computer Science, asked by dragongamer22, 1 day ago

Write a program in java to get the percentage of marks scored by a student in an examination and print the grade according to the criteria given below. Percentage of marks Grade
80 and above A+
60 and above but less than 80 A
50 and above but less than 60 B+
40 and above but less than 50 B
below 40 F

Answers

Answered by samarthkrv
0

Answer:

System.out.println("What is your marks in  each subject?");

  x = scanner.nextFloat();

  System.out.println("What is your marks in subject 1?");

  subject1 = scanner.nextFloat();

   if(subject1 > x)

   {

   System.out.println("please enter a valid format");

   subject1  = scanner.nextFloat();

   }

  System.out.println("What is your marks in subject2?");

  subject2 = scanner.nextFloat();

   if (subject2>x)

   {

   System.out.println("please enter a valid format");

   subject2 = scanner.nextFloat();

   }

  System.out.println("What is your marks in subject3?");

  subject3 = scanner.nextFloat();

   

   if (subject3>x)

   {

   System.out.println("please enter a valid format");

   subject3 = scanner.nextFloat();

   }

  System.out.println("What is your marks in subject4?");

  subject4 = scanner.nextFloat();

   if (subject4>x)

   {  

   System.out.println("please enter a valid format");

   subject4 = scanner.nextFloat();

   }

  System.out.println("What is your marks in subject5?");

  subject5 = scanner.nextFloat();

   if (subject5>x)

   {

   System.out.println("please enter a number less than" + x);

   subject5 = scanner.nextFloat();

   }

float percentage = ((subject1 + subject2 + subject3 + subject4 + subject5)/(x*5))*100;

if(percentage > 80)

System.out.println("Grades is A+");

if(percentage

Explanation:

Similar questions