PIC 10A Homework 7

custom essay writing service
Tutorial

PIC 10A Homework 7
Goals
To learn about separate compilation, classes, and vector manipulation.
Your Assignment
In this assignment the main has been written for you in the file phone_book_main.cpp. You will also notice that a class called Person has been declared as well as several prototypes for functions. You will define all of these in a file called hw7.cpp. Note: When you download these files, right click on the link and then choose save link as (or save as. The exact wording depends on browser you are using.)
How the program is supposed to function.
When you first run the program it fills a vector called phone_book with some default values and then outputs the contents of the vector. After this it displays a “menu” where the user can input a number to run a function that will manipulate the phone_book vector in some manner.

1) Add people to the phone book.

2) Erase a person from the phone book.

3) Sort the phone book.

4) Shuffle the phone book.

5) Reverse the phone book.

6) Print the phone book.

7) Look up a person in the phone book.

8) Quit.
Add people to the phone book.
Selecting this option runs a function: void add_people(vector &phone_book); This function will ask a user to enter a name or Q to quit. Next it will ask for a phone number. Then the function constructs a person object using the data the user gave and add it to the end of the phone book. Then the user is again told to enter a name or Q to quit and so on.

Note: The function void add_people(vector &phone_book); requires both getline and cin to be used (getline for the name and cin for the number). The mixing of the two causes a technical problem with the new line character. There is an explanation in the book as well. Basically what happens is that after the cin there is still a newline left over and if we try to use a getline again to read a name, it gets tripped up by it. The solution is to read that newline into a dummy variable. So put another getline after the cin. cout <> number; string clear; getline(cin, clear); // after this the next getline will work!
Erase a person from the phone book
When a user selects this option, it first asks the user for a name (This is done in main so you are not responsible for it) then runs a function: void erase(vector &phone_book, string name); This function finds the entry in the phone book with the corresponding name and then erases it.
Sort the phone book.
Selecting this option runs a function: void sort(vector &phone_book); This function sorts the vector phone_book in lexicographical order using the name entry of the Person class.
Shuffle the phone book.
Selecting this option runs the function: void shuffle(vector &phonebook); This function works much like the shuffle function discussed in class.
Reverse the phone book.
Selecting this option runs the function: void reverse(vector &phonebook); This function reverses the vector.
Print the phone book.
Selecting this option runs the function: void print(vector &phone_book); This function outputs the contents of the vector.
Look up a person in the phone book.
When a user selects this option it first asks the user for a name (This is done in main so you are not responsible for it) then runs a function: int lookup(const vector &phonebook, string name); This function returns the phone number of the Person with the matching name. Once your function returns the phone number to the main it is then outputted to screen. (This is done in main and you are not responsible for it.)
Other instructions
You need to be careful with indices. If someone searches for a person in your phone book who is not there your program should not crash! Your function lookup should return -1, for example, when the user wants to find a phone number for a Person who is not in the phone book.
Helpful hints
You are only creating file hw7.cpp and using it in combination with the files phonebook.h and phone_book_main.cpp already provided for you.
You CANNOT change the files phonebook.h and phone_book_main.cpp!
Your first step should be to get a program that compiles without writing all the details of the functions quite yet.
You will not be able to compile until all the functions definitions have been written. Write empty function definitions with just return statements where needed.
Once the program compiles, start filling in the functions inside hw7.cpp
You may write helper functions like swap when needed.
You may use the sort function defined in the algorith library.
Answer

Computer Science homework help
This is property of essay help USA. We provide the best online research help to individuals needing our assistance. Log in for Research paper writing help

Calculate the price
Make an order in advance and get the best price
Pages (550 words)
$0.00
*Price with a welcome 15% discount applied.
Pro tip: If you want to save more money and pay the lowest price, you need to set a more extended deadline.
We know how difficult it is to be a student these days. That's why our prices are one of the most affordable on the market, and there are no hidden fees.

Instead, we offer bonuses, discounts, and free services to make your experience outstanding.
How it works
Receive a 100% original paper that will pass Turnitin from a top essay writing service
step 1
Upload your instructions
Fill out the order form and provide paper details. You can even attach screenshots or add additional instructions later. If something is not clear or missing, the writer will contact you for clarification.
Pro service tips
How to get the most out of your experience with Essay Help USA
One writer throughout the entire course
If you like the writer, you can hire them again. Just copy & paste their ID on the order form ("Preferred Writer's ID" field). This way, your vocabulary will be uniform, and the writer will be aware of your needs.
The same paper from different writers
You can order essay or any other work from two different writers to choose the best one or give another version to a friend. This can be done through the add-on "Same paper from another writer."
Copy of sources used by the writer
Our college essay writers work with ScienceDirect and other databases. They can send you articles or materials used in PDF or through screenshots. Just tick the "Copy of sources" field on the order form.
Testimonials
See why 20k+ students have chosen us as their sole writing assistance provider
Check out the latest reviews and opinions submitted by real customers worldwide and make an informed decision.
History
Really impressive work! Thanks so very much.
Customer 453148, March 13th, 2019
Linguistics
This is an excellent resource for all of students' professional needs! If anyone out there needs a draft or paper proofread, this website will turn out to be very helpful! I Love being your customer and would recommend your services to other university students.
Customer 453250, August 5th, 2019
History
I lack enough words to say how grateful I am to you, the best writer I have.
Customer 453148, February 18th, 2019
Healthcare
This is by far the most eExcellent support team I have ever worked with in my several years of using custom assignment help companies. I like your innovative ways of resolving problems and delivering quality essay writing services.
Customer 453035, November 25th, 2019
Company Analysis
Nice job!!!
Customer 452565, April 26th, 2018
Education
My first impression is that they are reliable and competent at what they do. I highly recommend them. Their no-frills approach to customer service is unique.
Customer 453250, November 20th, 2020
Nursing
The best in healthcare capstone projects llike this one
Customer 453063, January 18th, 2021
Philosophy
This is an awesome philosophy. Clearly this expert has the required amount of competence and I will soon be entrusting him with the remaining assignment in this difficult class. Great job guys.
Customer 453037, October 1st, 2019
Education
Thank you admin for following up with the writer regarding my queries.
Customer 453250, December 13th, 2020
Education
The writer's tone of scientific writing is enviable. Such a scholarly talent!!
Customer 453250, March 12th, 2021
Design Analysis
thanks a bunch for the help. Though my professors are really tough tyrants, i've found refuge in your efficient assignment help service.
Customer 453154, June 18th, 2018
Environmental Studies
Outstanding work I recommend this writer to other students like me.
Customer 452569, December 22nd, 2018
11,595
Customer reviews in total
96%
Current satisfaction rate
3 pages
Average paper length
37%
Customers referred by a friend
OUR GIFT TO YOU
15% OFF your first order
Use a coupon FIRST15 and enjoy expert help with any task at the most affordable price.
Claim my 15% OFF Order in Chat
Show more