Write a program that keeps names and email addresses in a dictionary as key-value pairs. The program should display a menu that lets the user look up a person’s email address, add a new name and email address, change an existing email address, and delete an existing name and email address. The program should save the data stored in a dictionary to a file when the user exits the program. Each time the program starts, it should retrieve the data from the file and store it in a dictionary. The program should include the following functions: a. A function to display a menu. b. A function to look up a person’s email address. c. A function to add a new name and email address. d. A function to change an email address. e. A function to delete a name and email address. f. A function to load emails from a file. g. A function to save emails in a file. h. Write main function with a loop that displays the menu allowing the user to select an operation from the menu; the program continue until the user enter 5. i. Validate all user input. Your program should check user input; for example, if the user wants to search or delete a name that does not exist in the dictionary, you should print something like the name is not in the database. If the user selects invalid operation from the menu, the program prints an error and allows the user to renter a valid operation; the program continue asking for a valid operation until a user selects a valid operation.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question
100%

Write a program that keeps names and email addresses in a dictionary as key-value pairs.
The program should display a menu that lets the user look up a person’s email address, add a
new name and email address, change an existing email address, and delete an existing name and
email address. The program should save the data stored in a dictionary to a file when the user
exits the program. Each time the program starts, it should retrieve the data from the file and store
it in a dictionary.
The program should include the following functions:
a. A function to display a menu.
b. A function to look up a person’s email address.
c. A function to add a new name and email address.
d. A function to change an email address.
e. A function to delete a name and email address.
f. A function to load emails from a file.
g. A function to save emails in a file.
h. Write main function with a loop that displays the menu allowing the user to select an
operation from the menu; the program continue until the user enter 5.
i. Validate all user input. Your program should check user input; for example, if the user
wants to search or delete a name that does not exist in the dictionary, you should print
something like the name is not in the database.
If the user selects invalid operation from the menu, the program prints an error and allows
the user to renter a valid operation; the program continue asking for a valid operation
until a user selects a valid operation. 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Dictionary
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT