Computer Science, asked by BrainlyAnyu, 8 months ago


 \huge \underbrace \mathfrak \purple{question}
15.E ) Write a Java Program to display the grade of a student based on the following condition if marks greater than 80 the grade is “A+” otherwise grade is “A”.
 <font color =purple >
Please answer it fast....
× No spam pls ×

Answers

Answered by ConfusedPadhaku
14

\huge\underbrace\mathtt\red{QuestioN:}

Write a Java Program to display the grade of a student based on the following condition if marks greater than 80 the grade is “A+” otherwise grade is “A”.

\huge\underbrace\mathtt\green{AnsweR:}

***IN THE GIVEN PROGRAM U HAVE TO ENTER THE MARKS OF ALL SUBJECTS***

package com.tcc.java.programs;

import java.util.Scanner;

/**

* Java Program to print grade of a student

*/

public class StudentGrade {

   public static void main(String[] args) {

       int count, i;

       float totalMarks = 0, percentage, average;

       Scanner scanner;

       scanner = new Scanner(System.in);

       System.out.println("Enter Number of Subject");

       count = scanner.nextInt();

       System.out.println("Enter Marks of " + count + " Subject");

       for (i = 0; i < count; i++) {

           totalMarks += scanner.nextInt();

       }

       System.out.println("Total MArks : " + totalMarks);

       // Each subject is of 100 Marks

       percentage = (totalMarks / (count * 100)) * 100;

       /* Printing grade of a student using switch case statement */

       switch ((int) percentage / 10) {

       case 9:

           System.out.println("Grade : A+");

           break;

       case 8:

       case 7:

           System.out.println("Grade : A");

           break;

       case 6:

           System.out.println("Grade : B");

           break;

       case 5:

           System.out.println("Grade : C");

           break;

       default:

           System.out.println("Grade : D");

           break;

       }

   }

}

thanks ツツツ

@ConfusedPadhaku

Answered by chauhanaaditya43
5

Answer:

I have only coding of python

Attachments:
Similar questions