004-003-001

Switch Statement: Menu Selection

Easy

Problem Description

switch statement: Menu Selection

In this problem, you will create a program that reads a menu number (1–5), uses a switch statement to branch to the corresponding dish name and price, and displays the result to standard output.

Learning Objective: Implement selection processing based on discrete values using switch statement

Display dish name and price from restaurant menu number. Implement selection from multiple choices using switch statement.

Input

Line 1: Menu number (integer 1-5)

Output

[dish name]: [price] yen

Menu Correspondence

  • 1: Curry: 800 yen
  • 2: Ramen: 700 yen
  • 3: Pasta: 900 yen
  • 4: Rice bowl: 750 yen
  • 5: Set meal: 1000 yen

Examples

Example 1: Select Menu 1

Input:

1

Output:

Curry: 800 yen

Example 2: Select Menu 3

Input:

3

Output:

Pasta: 900 yen

Example 3: Select Menu 5 (Boundary)

Input:

5

Output:

Set meal: 1000 yen

Test Cases

※ Output examples follow programming industry standards

Normal case
Input:
2
Expected Output:
Ramen: 700 yen
Normal case
Input:
4
Expected Output:
Rice bowl: 750 yen

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