Ask Question
7 September, 19:47

How to hold numeric ranges and corresponding letter grade will be stored in a file java

+3
Answers (1)
  1. 7 September, 23:06
    0
    Print the grades on this Logic, this is logic for program and code is written under explanation.

    If the average of marks is > = 80 then prints Grade 'A'

    If the average is = 70 then prints Grade 'B'

    If the average is = 60 then prints Grade 'C'

    else prints Grade 'D'

    Explanation

    import java. util. Scanner;

    public class JavaGradeProgram

    {

    public static void main (String args[])

    {

    / * This program assumes that the student has 6 subjects that's why I have created the array of size 6. You can change this as per the requirement. * /

    int marks[] = new int[6];

    int i;

    float total=0, avg;

    Scanner scanner = new Scanner (System. in);

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

    System. out. print ("Enter Marks of Subject" + (i+1) + ":");

    marks[i] = scanner. nextInt ();

    total = total + marks[i];

    }

    scanner. close ();

    Calculate Average Here:

    avg = total / 6;

    if (avg >=80)

    {

    system. out. print ("A");

    }

    else if (avg>=70 && avg <=80)

    {

    system. out. print ("B");

    }

    else if (avg>=60 && avg <=70)

    {

    system. out. print ("C");

    }

    else

    {

    system. out. print ("D");

    }

    }

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “How to hold numeric ranges and corresponding letter grade will be stored in a file java ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers