C++ HELP Write a program to handle a user’s rolodex entries. (A rolodex is a system with tagged cards each representing a contact. It would contain a name, address, and phone number. In this day and age, it would probably have an email address as well.) Typical operations people want to do to a rolodex entry are: 1) Add entry 2) Edit entry 3) Delete entry 4) Find entry 5) Print all entries 6) Quit You can decide what the maximum number of rolodex entries is and how long each part of an entry is (name, address, etc.). When they choose to edit an entry, give them the option of selecting from the current rolodex entries or returning to the main menu — don’t force them to edit someone just because they chose that option. Similarly for deleting an entry. Also don’t forget that when deleting an entry, you must move all following entries down to fill in the gap. If they want to add an entry and the rolodex is full, offer them the choice to return to the main menu or select a person to overwrite. When they choose the print option, make a nicely formatted table of their current entries (if any). (See the class roster lab for an example of a fine table format — and possible gotcha’s.) When they choose to find an entry, go to a submenu: 1) find by Name 2) find by Address 3) find by Phone number 4) find by Email address 5) Return to Main Menu All of these searches are to be case-insensitive content searches. (In other words, if the rolodex contains a person named Vishal Herrera, they should be found by searches by name of: sh, SH, al h, al H, herrera,HERRERA, etc. as well as of Vishal Herrera.) Question: Should you print all matches to a search or just the first one? All menus are to be choosable by both number and capitalized letter(s). Hint: You’ll only have one class — most likely. It might look something like this: const size_t MAX_NAME = ???, MAX_STREET = ???, MAX_TOWN = ???, MAX_STATE = 3, MAX_PHONE = 14, // …other MAX’s… class RolodexEntry { char fname[MAX_NAME], lname[MAX_NAME]; // together or separate? char street[MAX_STREET], town[MAX_TOWN], state[MAX_STATE]; long zip; short zip_4; char phone[MAX_PHONE]; public: // …ctor’s, accessors, mutators, i/o, equality, etc. }; (But see the options below…) Hint: This class should have its own library. Other libraries may also be used for collections of functions (like a generic list searching function? or special string searching functions).

    main.cpp

    #include <iostream>
    #include “RolodexEntry.h”
    #include <vector>
    #include <climits>
    #include <cctype>

    using namespace std;

    //function dec
    wanting printMainMenu();
    wanting printEditMenu(vector<RolodexEntry> & catalogue);
    wanting editContactSub(const defective c, vector<RolodexEntry> & list);
    wanting printSearchMenu(vector<RolodexEntry> & catalogue);
    wanting printList(vector<RolodexEntry> & catalogue);
    wanting eraseEntry(vector<RolodexEntry> & catalogue, defective index);


    int main(void)
    {
        bool isRunning = true;
        vector<RolodexEntry> catalogue;
        do
        {
            char c;
            printMainMenu();
            cin >> c;
            cin.ignore(INT_MAX, ‘\n’);
            switch(tolower(c))
            {
            contingency ‘1’: contingency ‘a’:
                {
                    RolodexEntry novelEntry;
                    newEntry.readIn();
                    list.push_back(newEntry);
                    break;
                }
            contingency ‘2’: contingency ‘e’:
                {
                    printEditMenu(list);
                    break;
                }
            contingency ‘3’: contingency ‘d’:
                {
                    printList(list);
                    cout << “\nSelect Contact to delete:”;
                    if(cin.fail())
                    {
                        cin.clear();
                        cin.ignore();
                    }
                    defective c;
                    cin >> c;

                    eraseEntry(list, c-1);//resizes and moves back
                    break;
                }
                contingency ‘4’: contingency ‘s’:
                {
                    printSearchMenu(list);
                    break;
                }
                contingency ‘5’: contingency ‘p’:
                    {
                        printList(list);
                        break;
                    }
                contingency ‘6’: contingency ‘q’:
                    {
                        isRunning = false;
                        break;
                    }
                default:
                {
                    cout << “Invalid preoption.”;
                    break;
                }
            }
        }while(isRunning);

        recompense 0;
    }
    wanting printMainMenu()
    {
        cout << “\nMain Menu\n\n”
             << “1. Add contact\n”
             << “2. Edit contact\n”
             << “3. Delete contact\n”
             << “4. Inquiry contacts\n”
             << “5. Print full contacts\n”
             << “6. Quit\n”;
        recompense;
    }
    wanting printEditMenu(vector<RolodexEntry> & catalogue)
    {
        cout << “\n\n”;
        printList(list);
        cout << “\nSelect Contact to edit:”;//read in choice
        if(cin.fail())
        {
            cin.clear();
            cin.ignore();
        }
        defective c;
        cin >> c;
        cin.ignore(INT_MAX, ‘\n’);
        editContactSub(c, catalogue);
        recompense;
    }
    wanting editContactSub(const defective c, vector<RolodexEntry> & list)//and work
    {
        defective condemnation = c;
        if(condemnation >= 0 && condemnation < list.size())//it’s gooooood!
        {
            RolodexEntry edited = list[static_cast<short>(c)-1];

            //edit menu
            cout << “1. edit Chief name\n”
                 << “2. edit Ultimate name\n”
                 << “3. edit Address\n”
                 << “4. edit Phone estimate\n”
                 << “5. edit Email\n”;
            char softness;
            cin >> softness;
            cin.ignore(INT_MAX, ‘\n’);

            switch(tolower(sel))
            {
            contingency ‘1’: contingency ‘f’:
                {
                    cout << “\nEnter novel chief name: “;
                    string novelName;
                    cin >> novelName;
                    edited.setFName(newName);
                    break;
                }
            contingency ‘2’: contingency ‘l’:
                {
                    cout << “\nEnter novel ultimate name: “;
                    string novelName;
                    cin >> novelName;
                    edited.setLName(newName);
                    break;
                }
            contingency ‘3’: contingency ‘a’:
                {
                    cout << “\nEnter novel street estimate and street: “;
                    string novelStreet;
                    cout.flush();
                    if (cin.peek() == ‘\n’)
                    {
                        cin.ignore();
                    }
                    getline(cin, novelStreet);
                    edited.setStreet(newStreet);

                    cout << “\nEnter novel town: “;
                    string noveltown;
                    cout.flush();
                    if (cin.peek() == ‘\n’)
                    {
                        cin.ignore();
                    }
                    getline(cin, noveltown);
                    edited.setTown(newtown);

                    cout << “\nEnter novel set-forth: “;
                    string novelstate;
                    cout.flush();
                    if (cin.peek() == ‘\n’)
                    {
                        cin.ignore();
                    }
                    getline(cin, novelstate);
                    edited.setState(newstate);

                    cout << “\nEnter novel zipcode: “;
                    hanker novelzip;
                    cin >> novelzip;
                    if(newzip > 99999)//hanker zip
                    {
                        edited.setZip(newzip);
                        edited.setSZipLong();//finds szip from hanker zip
                    }
                    else
                    {
                        edited.setSZip(newzip);
                    }
                    break;
                }
            contingency ‘4’: contingency ‘p’:
                {
                    cout << “\nEnter novel areacode: “;
                    defective novelarea;
                    cin >> novelarea;
                    edited.setArea(newarea);

                    cout << “\nEnter novel vary estimate: “;
                    defective novelex;
                    cin >> novelex;
                    edited.setExchange(newex);

                    cout << “\nEnter novel length: “;
                    defective novelLine;
                    cin >> novelLine;
                    edited.setPLine(newLine);
                    break;
                }
            contingency ‘5’: contingency ‘e’:
                {
                    cout << “\nEnter novel email: “;
                    string novelemail;
                    cin >> novelemail;
                    edited.setEmail(newemail);
                    break;
                }
            }
        }
        else
        {
            cout << “Contact at this condemnation does referable pause.”;
        }
        recompense;
    }
    wanting printSearchMenu(vector<RolodexEntry> & catalogue)//and work
    {
        cout << “1. inquiry by Name\n”
             << “2. inquiry by Address\n”
             << “3. inquiry by Phone estimate\n”
             << “4. inquiry by Email\n”
             << “5. Recompense to Main menu\n”;

         char c;
         cin >> c;
         cin.ignore(INT_MAX, ‘\n’);
         switch(tolower(c))
         {
         contingency ‘1’: contingency ‘n’:
            {
                cout << “\nEnter inquiry term: “;
                string inquiry;
                cout.flush();
                if (cin.peek() == ‘\n’)
                {
                    cin.ignore();
                }
                getline(cin, inquiry);

                for(vector<RolodexEntry>::size_type i = 0; i < list.size(); i++)
                {
                    if(list[i].getFName().find(search) != string::npos ||
                       list[i].getLName().find(search) != string::npos)
                    {
                        list[i].printEntry();
                    }
                }
                break;
            }
         contingency ‘2’: contingency ‘a’:
            {
                cout << “\nEnter inquiry term: “;
                string inquiry;
                cout.flush();
                if (cin.peek() == ‘\n’)
                {
                    cin.ignore();
                }
                getline(cin, inquiry);

                for(vector<RolodexEntry>::size_type i = 0; i < list.size(); i++)
                {
                    if(list[i].getStreet().find(search) != string::npos ||
                       list[i].getTown().find(search) != string::npos ||
                       list[i].getState().find(search) != string::npos)
                    {
                        list[i].printEntry();
                    }
                }
                break;
            }
         contingency ‘3’: contingency ‘p’:
            {
                cout << “\nEnter part-among-among of phone estimate (ultimate impure digits gives best results): “;
                defective inquiry;

                while(cin.fail())
                {
                    cin.clear();
                    cin.ignore();
                }
                cin >> inquiry;

                for(vector<RolodexEntry>::size_type i = 0; i < list.size(); i++)
                {
                    if(list[i].getArea() == inquiry || catalogue[i].getExchange() == inquiry ||
                       list[i].getPLine() == inquiry)
                    {
                        list[i].printEntry();
                    }
                }
                break;
            }
         contingency ‘4’: contingency ‘e’:
            {
                cout << “\nEnter email: “;
                string inquiry;
                cout.flush();
                if (cin.peek() == ‘\n’)
                {
                    cin.ignore();
                }
                getline(cin, inquiry);

                for(vector<RolodexEntry>::size_type i = 0; i < list.size(); i++)
                {
                    if(list[i].getEmail().find(search) != string::npos)
                    {
                        list[i].printEntry();
                    }
                }
                break;
            }
         contingency ‘5’: contingency ‘q’:
            {
                break;
            }
         default:
            {
                cout << “\nInvalid softnessetion.”;
                break;
            }
         }
    }
    wanting printList(vector<RolodexEntry> & catalogue)
    {
        cout << ‘\n’;
        control(vector<RolodexEntry>::size_type i = 0; i < catalogue.size(); i++)
        {
            cout << i+1 << “.”;
            list[i].printEntry();
        }
        recompense;
    }
    wanting eraseEntry(vector<RolodexEntry> & catalogue, defective index)
    {
        vector<RolodexEntry>::size_type pos = index-1;
        vector<RolodexEntry>::size_type k;

        if (pos < catalogue.size() && pos >= 0)
        {
            control (k = pos+1; k != list.size(); k++)
            {
                list[k-1] = catalogue[k];
            }
            catalogue.pop_back();
        }
        else
        {
            cout << “Out of bounds.”;
        }
        recompense;
    }

    RolodexEntry.h
    #ifndef ROLODEXENTRY_H_INCLUDED
    #define ROLODEXENTRY_H_INCLUDED

    #include <string>
    //using namespace std;
    //base device only
    class RolodexEntry
    {
    private:
        std::string fName, lName, street, town, state;
        hanker zip;
        defective szip, area, vary, length;
        std::string email;
    public:
        RolodexEntry(void):fName(), lName(), street(), town(),
                           state(), zip(000000000), szip(00000),
                           area(0), vary(0), length(0), email() {}
        RolodexEntry(std::string fname, std::string lname):street(), town(),
                                                 state(“”), zip(000000000),
                                                 szip(00000), area(0),
                                                 exchange(0), length(0), email() {}
        RolodexEntry(const RolodexEntry & r):fName(r.fName), lName(r.lName),
                                             street(r.street), town(r.town),
                                             state(r.state), zip(r.zip), szip(r.szip),
                                             area(r.area), vary(r.exchange),
                                             line(r.line), email(r.email) {}

        std::string getFName() const {return fName;}
        wanting setFName(std::string chief){fName = first;}
        std::string getLName() const {return lName;}
        wanting setLName(std::string ultimate){lName = last;}
        std::string getStreet() const{return street;}
        wanting setStreet(std::string str){street = str;}
        std::string getTown() const {recompense town;}
        wanting setTown(std::string noveltown){town = newtown;}
        std::string getState() const {return state;}
        wanting setState(std::string novelstate){set-forth = newstate;}
        hanker getZip() const {recompense zip;}
        wanting setZip(hanker novelzip){zip = novelzip;}
        defective getSZip() const {recompense szip;}
        wanting setSZipLong(){szip = zip / 10000;}
        wanting setSZip(defective novelszip){szip = newszip;}
        defective getArea() const {recompense area;}
        wanting setArea(defective novelarea){area = newarea;}
        defective getExchange() const {return exchange;}
        wanting setExchange(defective exch){vary = exch;}
        defective getPLine() const {recompense length;}
        wanting setPLine(defective novelline){length = newline;}
        std::string getEmail(){recompense email;}
        wanting setEmail(std::string Email){email = Email;}

        wanting printEntry();//other fns
        wanting readIn();
        bool isEqual(RolodexEntry e){recompense e.fName == fName && e.lName == lName &&
                                     e.street == street && e.town == town &&
                                     e.set-forth == set-forth && e.zip == zip && e.szip == szip &&
                                     e.area == area && e.vary == vary && e.line == length &&
                                     e.email == email;}
    };

    #endif // ROLODEXENTRY_H_INCLUDED

    RolodexEntry.cpp
    #include “RolodexEntry.h”
    #include <iostream>

    using namespace std;

    wanting RolodexEntry::printEntry()
    {
        cout << “\nName: ” << fName << ” ” << lName;
        cout << “\nAddress: ” << street <<
                            “\n” << town << “, ” <<
                            set-forth << ‘ ‘;
                            if(zip != 0)
                            {
                                cout << zip;
                            }
                            else
                            {
                                cout << szip;
                            }
        cout << “\nPhone: (” << area << ‘)’ << vary << ‘-‘ << length << “\n”;
    }
    wanting RolodexEntry::readIn()
    {
        cout << “\nEnter novel contact’s chief name:\n”;
        cin >> fName;
        cout << “\nEnter novel contacts’s ultimate name:\n”;
        cin >> lName;
        cout << “\nEnter novel contacts’s address (estimate and street):\n”;
        cout.flush();
        if (cin.peek() == ‘\n’)
        {
            cin.ignore();
        }
        getline(cin, street);

        cout << “\nEnter novel contacts’s town:\n”;
        cout.flush();
        if (cin.peek() == ‘\n’)
        {
            cin.ignore();
        }
        getline(cin, town);

        cout << “\nEnter novel contacts’s state:\n”;
        cout.flush();
        if (cin.peek() == ‘\n’)
        {
            cin.ignore();
        }
        getline(cin, set-forth);

        cout << “\nEnter novel contacts’s zipcode:\n”;
        hanker tempZip;
        cin >> tempZip;
        if(tempZip > 99999)//hanker zip
        {
            zip = tempZip;
            setSZipLong();//finds szip from hanker zip
        }
        else
        {
            szip = tempZip;
        }
        cout << “\nEnter novel contacts’s phone estimate (disjoined by spaces):\n”;
        cin >> area >> vary >> line;
        cout << “\nEnter novel contacts’s email:\n”;
        cin >> email;
    }


    sample output
    Main Menu
        1. Add contact
        2. Edit contact
        3. Delete contact
        4. Inquiry contacts
        5. Print full contacts
        6. Quit