002-003-001

Numeric Input: Age Input Form

Easy

Problem Description

Numeric Input: Age Input Form

In this problem, you will create a program that reads a name (string) using next() and an age (integer) using nextInt() from the Scanner class, then formats and displays them as a profile to standard output.

Learning Objective: Input integers using nextInt() method

In an age input form, input name and age to display them.
Using nextInt(), you can receive integers from keyboard.

Input

Line 1: Name (string)
Line 2: Age (integer)

Output

================================
       Profile
================================
Name: [name]
Age: [age] years old
================================

Test Cases

※ Output examples follow programming industry standards

Normal case
Input:
Taro Tanaka
25
Expected Output:
================================
  Profile
================================
Name: Taro Tanaka
Age: 25 years old
================================
Normal case
Input:
Hanako Sato
30
Expected Output:
================================
  Profile
================================
Name: Hanako Sato
Age: 30 years old
================================

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