Question
def menu(): print(______________________________________________) print(--A Phone Book Management Program by abcd001--) print(______________________________________________) print(1. Look up a contact) #it is implemented print(2. Add a new contact) #it
def menu(): print("______________________________________________") print("--A Phone Book Management Program by abcd001--") print("______________________________________________") print("1. Look up a contact") #it is implemented print("2. Add a new contact") #it is implemented print("3. Change an existing contact") print("4. Delete a contact") print("5. Display all contacts") print("6. Quit the program") print("______________________________________________") print("Enter your choice : ",end="") ch=int(input()) #input choice print("______________________________________________") return ch
Q1. A Phone Book Management Program In this question, you are going to use the class structures in Python to implement a simple phone book management program. Your program should display the contact records, assist the adding, removing searching and updating records in the phone book. (50 Marks) The contact records are stored in a file called "contacts.txt" using each line holds the information of a known contact including the name, phone number and email address The information in this file is read into the program and stored (as a list of "Contact" objects) in an object of the "PhoneBook" class. When the program exists, it will automatically save the updated contact records into a file called "contacts2.txt". Please DO NOT MODIFY the content of the "contacts.txt" file ["John", "7589943", "john@amail.com"] ["Kelly", "4344345", "kelly@bmail.com"] ["Nicky", "8774104", "nicky?cmail.com"] ["Sam", "5723943", "sam@cimail.com" the JSON format. As seen below You are provided with the following Python files in the 'A101Resource.zip': ntact.py-contains the contact class to store the information of a phone record. Please DO NOT MODIFY the content of this file PhoneBook.py-contains the PhoneBookclass (TO BE COMPLETED) so that it stores and manages the phone records A1Q1abcd001. Py-contains the functions (TO BE COMPLETED) that display the menu and calls the methods defined in the PhoneBook class to fulfill the functions of the program. You need to understand al the files, but the only files that you are allowed to modify are the PhoneBook.py and A1Q1abcd001.py files There are ten functions defined in the PhoneBook class as follows Methods load records (self,filename) Functionalities This function reads the contact records from a text file This function saves the contact records into a text file This function obtains the size of the phone book This function finds a record in the phone book bv a given name This function prints out a record in the required format This function fulfills the search a contact record in the phone book This function adds a new contact record to the lementation is GIVEN to you save records (self, filename) (Implementation is GIVEN to you.) get_size () Implementation is GIVEN to you find a record (self, name) display_a_record (self,item) search a record (self) add a record (self) update_a_record (self) delete a record (self) display_records (self) hone book. This function changes the contact information of an existing record This function removes a contact record in the hone book This function prints out all the contact records in the phone book Complete the required methods accordingly described in the following 6 tasks to achieve the functions of the program IMPORTANT: Test each function after you have completed it and make sure that the program runs as described
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