Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help in Java Programming Question: Write a declaration of a private field named Student that can hold an ArrayList. The elements of the

I need help in Java Programming Question:

Write a declaration of a private field named Student that can hold an ArrayList. The elements of the ArrayList are of type ComputerScience. Write an assignment to the student variable to create an appropriate ArrayListobjects.

Create a class MapTester and use HashMap to implement a phonebook

given below:

HashMapphoneBook = new HashMap();
phoneBook.put("Homer Jay Simpson", "(531) 9392 4587"); phoneBook.put("Charles Montgomery Burns", "(531) 5432 1945"); phoneBook.put("ApuNahasapeemapetilon", "(531) 4234 4418"); 
 
 
 
I) In the HashMapclass,implement two methods :
 

public void enterNumber(String name, String number)and

public String lookupNumber(String name)

The methods should use the put and get methods of the HashMap class to implement

their functionality.

What happens when you add an entry to a map with a key that already exists in

the map?

What happens when you add an entry to a map with two different keys?

How do you check how many entries are contained in a map?

How do you print all the keys currently stored in a map?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

Define Administration and Management

Answered: 1 week ago