Grade Point to Letter Grade Conversion

Explanation:

  1. Input:
    • The program prompts the user to enter a grade point between 0 and 4.
  2. Switch Statement:
    • The switch statement checks the value of gradePoint.
    • Each case corresponds to a specific letter grade:
      • case 4: Outputs “A.”
      • case 3: Outputs “B.”
      • case 2: Outputs “C.”
      • case 1: Outputs “D.”
      • case 0: Outputs “F.”
    • The default case handles any input outside the range of 0-4, displaying an error message.
  3. Output:
    • Depending on the input, the program prints the corresponding letter grade.

 

Example Outputs:

Example 1: Valid Input

Input:

  • Grade Point: 4

Output:

Example 2: Valid Input

Input:

  • Grade Point: 2

Output:

Example 3: Invalid Input

Input:

  • Grade Point: 5

Output: