Write a program that allows the user to create and maintain a list of contacts in a file named MyContacts.txt. Each contact will have a name and a phone number. In the file, each line should have a contact's name followed by their phone number single word (i.e. no last names) you may assume that every contact's name will just be a For example, if your file has two contacts in it, it might look something like this: Bob 555-1234 Jill 555-4321 Recall that if you try to open a file for reading before it exists, the program will crash. Therefore, assume the user will fırst try to add a contact as their first option (i.e. I won't try to print the list or print a number first when I'm testing your code). In the addContact method, when you open a file for appending, it will be created for you. In a while loop, continually ask the user what option they would like to choose. Each option (other than the quit option) should call a function which performs a specific task. Their options are: 1. Call a function named printList: This function should print out the data in MyContacts.txt in the following way: Contact 1: Bob Phone Number: 555-1234 Contact 2: Jill Phone Number: 555-4321 etc... 2. Call a function named findNumber which will find the phone number of a specific contact by asking the user enter a name. If the name is found in MyContacts.txt, return its corresponding phone number. Otherwise, return the empty string (quote-quote). Back in main, if a number is returned from fındNumber, print it out. If the empty string is returned, tell the user the contact doesn't exit. 3. Call a function named addContact which will allow the user to add a contact to the file. In this function, ask the user to enter a name and phone number and then append these values to the end of MyContacts.txt. Again, you may assume that the user will only enter single-word names.
Write a program that allows the user to create and maintain a list of contacts in a file named MyContacts.txt. Each contact will have a name and a phone number. In the file, each line should have a contact's name followed by their phone number single word (i.e. no last names) you may assume that every contact's name will just be a For example, if your file has two contacts in it, it might look something like this: Bob 555-1234 Jill 555-4321 Recall that if you try to open a file for reading before it exists, the program will crash. Therefore, assume the user will fırst try to add a contact as their first option (i.e. I won't try to print the list or print a number first when I'm testing your code). In the addContact method, when you open a file for appending, it will be created for you. In a while loop, continually ask the user what option they would like to choose. Each option (other than the quit option) should call a function which performs a specific task. Their options are: 1. Call a function named printList: This function should print out the data in MyContacts.txt in the following way: Contact 1: Bob Phone Number: 555-1234 Contact 2: Jill Phone Number: 555-4321 etc... 2. Call a function named findNumber which will find the phone number of a specific contact by asking the user enter a name. If the name is found in MyContacts.txt, return its corresponding phone number. Otherwise, return the empty string (quote-quote). Back in main, if a number is returned from fındNumber, print it out. If the empty string is returned, tell the user the contact doesn't exit. 3. Call a function named addContact which will allow the user to add a contact to the file. In this function, ask the user to enter a name and phone number and then append these values to the end of MyContacts.txt. Again, you may assume that the user will only enter single-word names.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
DO NOT COPY AND PASTE THE ANSWER THAT CHEGG HAS FOR THIS QUESTION. I HAVE ASKED THIS QUESTION ONCE AND THE "EXPERT" COPIED AND PASTED THE ANSWER FROM CHEGG. PLEASE ACTUALLY SOLVE THIS PROBLEM, OR I'LL JUST HAVE TO CANCEL MY BARTLEBY SUBSCRIPTION.
C++ Question
Hello Please answer the following attached C++

Transcribed Image Text:Write a program that allows the user to create and maintain a list of contacts in a file named MyContacts.txt. Each
contact will have a name and a phone number. In the file, each line should have a contact's name followed by their
phone number
you may assume that every contact's name will just be a
single word (i.e. no last names)
For example, if your file has two contacts in it, it might look something like this:
Bob 555-1234
Jill 555-4321
Recall that if you try to open a file for reading before it exists, the program will crash. Therefore, assume the user will
fırst try to add a contact as their first option (i.e. I won't try to print the list or print a number first when l'm testing your
code). In the addContact method, when you open a file for appending, it will be created for you.
In a while loop, continually ask the user what option they would like to choose. Each option (other than the quit option)
should call a function which performs a specific task. Their options are:
1. Call a function named printList: This function should print out the data in MyContacts.txt in the following way:
Contact 1: Bob Phone Number: 555-1234
Contact 2: Jill Phone Number: 555-4321
etc..
2. Call a function named findNumber which will find the phone number of a specific contact by asking the user enter a
name. If the name is found in MyContacts.txt, return its corresponding phone number. Otherwise, return the empty
string (quote-quote). Back in main, if a number is returned from findNumber, print it out. If the empty string is returned,
tell the user the contact doesn't exit.
3. Call a function named addContact which will allow the user to add a contact to the file. In this function, ask the user
to enter a name and phone number and then append these values to the end of MyContacts.txt. Again, you may assume
that the user will only enter single-word names.
4. Quit the program
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 7 steps with 4 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY