020-003-005

Map Management: Phonebook

Easy

Problem Description

In this problem, you will create a program that stores name-and-phone-number pairs into a LinkedHashMap in registration order, then displays the full list and total count to standard output.

Map Management: Phonebook

Learning Objective: Manage key-value pairs with LinkedHashMap, perform data storage, retrieval, and listing

HashMap is data structure storing "key (identifier) and value (data)" pairs. Like phonebook, can manage relationships like "name → phone number". Add pairs with put() method, retrieve corresponding value from key with get() method. Check key existence with containsKey().

Input

Line 1: Number of registrations (integer, 1-10 people)
Lines 2~N+1: Name and phone number (space-separated)

Output

Phonebook:
[name 1]: [phone number 1]
[name 2]: [phone number 2]
...
Total Contacts: [registration count]
```java

Contacts displayed in registration order.

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