1. Create a hash with a set of names and phone numbers. Populate the hash with five...
Question:
1. Create a hash with a set of names and phone numbers. Populate the hash with five sets of data. Ask the user which name they would like to look up the phone number for, and use that as the key to display the number.
2. Set up a hash that contains a few city names and their corresponding zip codes (guess if you don’t know them). Then, display the names of the cities and ask the user to enter one. Display the corresponding zip code.
Reverse the hash and display the zip codes, asking the user to choose one. Display the city for that zip code. You can display the lists of cities and zip codes any way you want, or display both at the same time with the keys function,
3. Modify the last program you wrote to:
- Display the current hash, and ask the user if they want to add a new entry. If they do, prompt for the city and zip and add it to the hash
- Display the hash again and ask if the user wants to delete an entry. If they do, ask for the hash key to delete, and remove that entry
- Perform the same lookups for city and zip as before, but check to make sure the keys exist. If not, display an error message.
Fundamentals of Database Systems
ISBN: 978-0136086208
6th edition
Authors: Ramez Elmasri, Shamkant Navathe