008-002-001
Object Method: Profile Display
Easy
Problem Description
Object method: Profile Display
In this problem, you will create a program that instantiates a Profile class object, calls its display() method, and displays the name and age to standard output.
Learning Objective: Call object method for output
Create Profile class object and call display method to show profile. Call methods from objects.
Input
Line 1: Name (string)
Line 2: Age (integer)
Output
Name: [name]
Age: [age] years old
Examples
Example 1: Taro age 20
Input:
Taro
20
Output:
Name: Taro
Age: 20 years old
Example 2: Hanako age 25
Input:
Hanako
25
Output:
Name: Hanako
Age: 25 years old
Example 3: 1 character, age 0 (boundary)
Input:
A
0
Output:
Name: A
Age: 0 years old
Test Cases
※ Output examples follow programming industry standards
Normal case
Input:
Alice 30
Expected Output:
Name: Alice Age: 30 years old
Normal case
Input:
Bob 15
Expected Output:
Name: Bob Age: 15 years old
Your Solution
Current Mode:● My Code
Profile.java🔒
Solution.java🔒
2/6 ファイル96B
⚠️警告
- No main method found
9
1
2
3
4
›
⌄
import java.util.Scanner;
class Profile {
}
0 B / 5 MB
You have 10 free executions remaining
