001-003-002
Variable Initialization: Student ID Card
Easy
Problem Description
Variable Initialization: Student ID Card
Learning Objective: Understand how to set initial values when declaring variables
Create a program that displays a student ID card when you input student information. Initialize school name and grade as fixed values in variables, and receive the name from input.
Input
Line 1: Student name (string)
Output
================================
Student ID Card
================================
School: JavaDrill High School
Grade: 1st year
Name: [name]
================================
```java
## Examples
### Example 1: Taro Tanaka's Student ID
Input:
```java
Taro Tanaka
```java
Output:
```java
================================
Student ID Card
================================
School: JavaDrill High School
Grade: 1st year
Name: Taro Tanaka
================================
Test Cases
※ Output examples follow programming industry standards
Input:
Taro Tanaka
Expected Output:
================================ Student ID Card ================================ School: JavaDrill High School Grade: 1st year Name: Taro Tanaka ================================
Input:
SuzukiHanako
Expected Output:
================================ Student ID Card ================================ School: JavaDrill High School Grade: 1st year Name: SuzukiHanako ================================
Input:
A
Expected Output:
================================ Student ID Card ================================ School: JavaDrill High School Grade: 1st year Name: A ================================
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
›
⌄
⌄
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
// 学校名を初期化(固定値)
String school = "JavaDrill High School";
// 学年を初期化(固定値)
String grade = "1st year";
// キーボードからのユーザー入力を読むためのScannerオブジェクトを準備
Scanner sc = new Scanner(System.in);
// 名前を入力から受け取る
String name = sc.nextLine();
// 学生IDカードを表示
System.out.println("================================");
// [出力処理] 結果を画面に表示
System.out.println(" Student ID Card");
// [出力処理] 結果を画面に表示
System.out.println("================================");
// [出力処理] 結果を画面に表示
System.out.println("School: " + school);
// [出力処理] 結果を画面に表示
System.out.println("Grade: " + grade);
// [出力処理] 結果を画面に表示
System.out.println("Name: " + name);
// [出力処理] 結果を画面に表示
System.out.println("================================");
}
}
0 B / 5 MB
You have 10 free executions remaining
