002-002-008
String Input: Address Card Creation
Easy
Problem Description
String Input: Address Card Creation
Learning Objective: Input multiple lines of text using the nextLine() method
In this problem, you will create a program that reads three lines of string input (name, ZIP code, and address) using Scanner's nextLine() method and displays them in a formatted address card to standard output.
Create a program to make an address card. Input multiple string values using nextLine() and display them in card format.
Input
Line 1: Name (string)
Line 2: ZIP code (string)
Line 3: Address (string)
Output
+------------------+
| ADDRESS CARD |
+------------------+
| Name: [name]
| ZIP: [zip code]
| Address: [address]
+------------------+
Examples
Example 1
Input:
Yamada Taro
123-4567
Tokyo Shibuya
Output:
+------------------+
| ADDRESS CARD |
+------------------+
| Name: Yamada Taro
| ZIP: 123-4567
| Address: Tokyo Shibuya
+------------------+
Example 2
Input:
Sato Hanako
987-6543
Osaka Namba
Output:
+------------------+
| ADDRESS CARD |
+------------------+
| Name: Sato Hanako
| ZIP: 987-6543
| Address: Osaka Namba
+------------------+
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up