Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Objectives: Java allows for a quick and easy way to implement map data structures while programming. Maps are helpful as data is stored in a
Objectives: Java allows for a quick and easy way to implement map data structures while programming. Maps are helpful as data is stored in a keyvalue pair, making it easy and fast to access data. Java also provides the ability to override methods, including methods such as the equals and toString methods in classes. Completing this assignment students demonstrate knowledge of:
Creating Maps
Adding elements to maps
Overriding toString equals and hashCode
Task Description: A company that develops phones has hired you to create a contact system. The company wants each contact object to having a name, phone number hash map where keys are home, cell, and office street address, and email. They have specified that they do not want to have duplicate names inside of the contact list. You have decided to implement this with a HashMap where the key will be the contact's name, and the value will be a contact object.
Implement the following functionality:
Add new contact.
a Adds a contact to the system.
b A contact is new if its name is not already associated with a contact.
c If the user attempts to create a contact with a name already associated with a contact an appropriate message should be output and the user should be returned to the menu.
Edit existing contact.
a Allows the user to modify a contact already in the system.
b Allow the user to modify the contact's name.
i The map should be updated accordingly when the contact's name is changed.
c Implement editing at least one of the three phone numbers, the street address, or the email address of the contact.
List all contacts and print one to the console.
a Allow the user to choose a contact to print to the console.
b Override toString method to print to the console.
Contacts should be entered manually. Since there is a manual entry, there should be a check that makes sure that contact does not already exist. You should use the equals method to make sure an entry of a contact does not exist before adding their object to the map. This means that you will need to override this inside of the contact's class.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started