017-004-002

Multi-branch Control: Grade Message

Easy

Problem Description

Multi-branch Control: Grade Message

In this problem, you will create a program that evaluates a grade (A–F) using a switch statement and displays the corresponding encouragement message to standard output.

Learning Objective: Use switch statement to select message based on grade

Create program to receive grade evaluation (A-F) and display corresponding encouragement message. Learn how to select appropriate message from multiple choices with switch statement.

Understanding with Concrete Examples

Example 1: Highest Grade (A)

Input: A
Output:
Grade Feedback:
Grade: A
Message: Excellent work!

Example 2: Medium Grade (C)

Input: C
Output:
Grade Feedback:
Grade: C
Message: Keep trying!

Example 3: Failing Grade (F)

Input: F
Output:
Grade Feedback:
Grade: F
Message: Please study more!

Input

Line 1: Grade evaluation (character, A/B/C/D/F)

Output

Grade Feedback:
Grade: [grade]
Message: [message]

Message mapping:

  • A: Excellent work!
  • B: Good job!
  • C: Keep trying!
  • D: Need improvement!
  • F: Please study more!

Test Cases

※ Output examples follow programming industry standards

Normal case
Input:
A
Expected Output:
Grade Feedback:
Grade: A
Message: Excellent work!
Normal case
Input:
C
Expected Output:
Grade Feedback:
Grade: C
Message: Keep trying!

Your Solution

Current Mode: My Code
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here

sc.close();
}
}
0 B / 5 MB

You have 10 free executions remaining