Ask Question
14 May, 00:39

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

+2
Answers (1)
  1. 14 May, 03:32
    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?
Find an answer to your question ✅ “How to hold numeric ranges and corresponding letter grade will be stored in a file java ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers