Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Ifthe first option ofthe menu, ie-Look up a contact, s selected te program should allow the user to search for a lnown contact in the
Ifthe first option ofthe menu, ie-Look up a contact, s selected te program should allow the user to search for a lnown contact in the phone book Its exact layout should have the same format as shown below -- A Phone Book Management Brogram by abcd001 1. Look up a contact 2. Add a new contact 3. Change an existing contact 4. Delete a contact Di9play all contacts 6. Quit the program Enter your choice: 1 COMPSCI 105 S2 C -Assimment One 4 of 13 Enter the name: Kelly Name: Kelly Phone: 4344345 Email: kelly@bmail.com 1. Look up a contact 2. Add a new contact 3. Change an existing contact 4. Delete a contact 5. Display all contacts 6. Quit the program Enter your choice: 1 Enter the name: James James is not found in the phone book. 1. Look up a contact 2. Add a new contact 3. Change an existing contact 4. Delete a contact 5. Display all contacts 6. Quit the program Enter choice: To achieve the above task, you need to implement the find a record), display_a record () and search a_record0 fumctions inside the EhoneBookclass. The find_a record (sel, name) function locates the contact record that matches the given name from its parameter. The fumction returms the Contact object has the same name, or the value None if no matching record was found The display_a_record (self, item)function prints out a contact record in the format illustrated in the above example. The search_a record (sel fulfills the function of searching for a contact record with an user input name. The function requests for an user imput, then it makes use of the find_a record ( to determine whether the imput name exists in the phone book or not If a matching name is tound, it will make use of the display_a_record) fmction to print out the contact record. Othermise, if no matching name found, it prints out the not-found message. The sample input output are shown in the above example
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