Ask Question
18 November, 18:50

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

+2
Answers (1)
  1. 18 November, 19:47
    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?
Find 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 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