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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education