Ask Question
8 October, 09:43

Submit program Grades using Swicth - Case (Java)

Write a program to enter the grade of a student as integer from the key board such that the out put will indicate the letter grade if it is an A, B, C, D. or F using Switch - Case.

90 and up is A

80 and up is b

70 and up is C

60 and up is D

all under 60 is F

+4
Answers (1)
  1. 8 October, 10:09
    0
    import java. util.*;

    import java. util. Scanner;

    import java. io.*;

    public class Main

    {

    public static void main (String[] args) {

    System. out. println ("Enter the percentage:");

    Scanner sc1 = new Scanner (System. in);

    int percent=sc1. nextInt ();

    switch ((int) percent/10)

    {

    case 10:

    case 9:

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

    break;

    case 8:

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

    break;

    case 7:

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

    break;

    case 6:

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

    break;

    case 5:

    case 4:

    case 3:

    case 2:

    case 1:

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

    break;

    }

    }

    }

    Explanation:

    The program is as mentioned above. The grades are alloted as per the marks.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Submit program Grades using Swicth - Case (Java) Write a program to enter the grade of a student as integer from the key board such that ...” 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