Ask 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 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

+1
Answers (1)
  1. 19 March, 12:37
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers