Please do not copy and paste the answer that Chegg has for this question. I have asked this question already 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 create the correct code based on the attached requirement picture. Please make sure the code is functional. Please do not use any Advanced C++ syntax. Thank you.

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...
icon
Related questions
Question

Please do not copy and paste the answer that Chegg has for this question. I have asked this question already 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 create the correct code based on the attached requirement picture. Please make sure the code is functional. Please do not use any Advanced C++ syntax. Thank you.

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. Note: To simplify things, for this assignment, 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
first 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 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
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. Note: To simplify things, for this assignment, 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 first 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 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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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 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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY